c++ - How to get the address of node->next pointer -
i writing code on doubly linked list following function
struct node { int data; struct node *next; struct node *prev; }; /* given node next_node, insert new node before given node */ void insertbefore(struct node** next_node, int new_data)
i called insertbefore() main function:
insertbefore(&head, 2); // works fine
but can't same fore head->next, because next pointer node* not node**
insertbefore(head->(&next), 2); // doesn't works
how can solve problem.please help.thanks
assuming function works, &(head->next)
need.
insertbefore(&(head->next), 2);
Comments
Post a Comment