Question: C++ Let head be a pointer that points to a linked list with a certain number of nodes. What happens in a call to: delete
C++
Let head be a pointer that points to a linked list with a certain number of nodes. What happens in a call to: delete head; ?
1)All nodes in the list will be freed.
2)The first node on the list will be freed but the rest will just be lost, generating a memory leak.
3)Nothing. The language takes care of not allowing to delete the head if it points to a list.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
