delete node

if i want to delete a node in a linked list
recursively.
what shall i send from the main in order test my function what i wrote

1
2
3
4
5
6
7
8
9
10
11
IntSLLNode  deleteNode( int node, IntSLLNode ptr ) {
       if( ptr == 0 )
          return ptr;
       else
       if ( ptr->info == node )
          return (ptr->next);
       else {
          ptr->next = deleteNode( node, ptr->next );
          return ptr;
       }
    }
anyhelp?
what shall i send from the main in order test my function what i wrote
anyhelp?


Looks like you shall send it an int and a pointer.

Since it never removes a node/value from the list, however, I wouldn't hold my breath waiting for the test to succeed.
so shall the user inter the num of the node that he want to delete?
then we call the function by deleteNode(node,ptr);
Topic archived. No new replies allowed.