Hello,
Let's say i have a struct
Code:struct node { int item; struct node *next };
The code for traversing a linked list is this
Here comes my stupid question.Since current is a node,wouldn'tCode:while(current != NULL) { current->item=5; current = current->next; }
replace the node current with the next one and lose all the information we know about the current node?Code:current = current->next;