How to delete the only node in a double linked list?
1 2 3 4 5 6 7
|
else if (head->next == NULL)
{
T output;
output = head->data;
delete head; //head is now invalid
return output;
}
|
`head' ends in an invalid state, set it to null.
also, you said that you return T, null may be not be a valid replacement.
Thank you good sir :)
Topic archived. No new replies allowed.