MSVC 2003 Debugging delete
I am not sure what I am doing incorrectly but when I step through with the debugger after selecting "delete head" it still retains its original address:
The node head is not set to zero.
current = head;
fprintf(fpDebug, "\nDeleteAllNodes from head to tail.\n");
temp = head;
if(head->next == 0)
head = head->next;
fprintf(fpDebug, "Delete %4d current = %9p prev = %9p\n", test, temp, temp->prev);
fprintf(fpDebug, "Delete %4d head = %9p prev = %9p\n", test, temp, temp->prev);
return; // head still has its original address!!!
This really screws me up in my next call because I use head to control my creation of the new linked list.
if (! head )
head = new node;
tail = current = head; // set current and tail = to head
current->next = 0; // set next node to zero.
current->prev = 0; // set prev node to zero or possibly set to tail!!!
Do you see anything wrong with how I am calling delete?