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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!