Hello
I am not sure if my function below will completely delete a linked list. I am worried it will delete every element of the list except for the head(first node)?
For example; If I have this linked list below
L -> 1 -> 2 -> 3 -> 4 -> NULL
Will my function delete the 1st node (1)?
void destroy(node * & L)
{
node *temp = L;
while(temp != NULL){
temp = temp->next;
delete L;
L = temp;
}
}