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

Popular posts from this blog

python - Best design pattern for collection of objects -

go - serving up pdfs using golang -

python - django admin: changing the way a field (w/ relationship to another model) is submitted on a form so that it can be submitted multiple times -