c++ - How to write a recursive function for this? -
int main() { lstnode tmp_list; tmplist.insrtnumber( 10 ); tmplist.insrtnumber( 19 ); tmplist.insrtnumber( 39 ); tmplist.prntlist( ); return 0; }
how write recursive print function? totally confused , not know start from? appreciated.
// print list void list_node::print_list () { print_remaining_nodes ( list_head ); } void list_node::print_remaining_nodes( number_node* from_node ) { if ( from_node == null ) { return; } else { cout << " " << from_node->value << " --- "; print_remaining_nodes (from_node->next_node); } };
Comments
Post a Comment