Anyone know why the first code doesn't work while the second one does?
1 2 3 4 5 6 7 8
|
Node* cur = first;
Node* tmp;
while (cur != 0)
{
tmp = cur;
cur = cur->next;
delete tmp;
}
|
1 2 3 4 5 6 7 8
|
Node** cur = &first;
Node* tmp;
while (*cur != 0)
{
tmp = *cur;
*cur = tmp->next;
delete tmp;
}
|
Last edited on