Hi,
I am having difficulty deleting nodes from a singly linked list.
If I have the following structure:
NODE1----->NODE2----->NODE3
...and wish to delete NODE2, I have been setting a temp pointer to NODE3 (as NODE2->next), with a view to making NODE1 point to NODE3. The problem is, my NODE3 pointer is in fact NODE2->next, which is set to NULL as soon as I free up the memory for NODE2.
How can I set a pointer to NODE3 without losing it when I get rid of NODE2 (without using pointers to the previous node)?
Thanks for any suggestions.
Paul