Data Structures :: Linked Lists - Discussion
Home > Data Structures > Linked Lists > MCQs Questions Discussion
14 / 48
Choose the correct option.
"p" and "q" are pointers to a node of the linked list, "head" points to the first node of the list, "next" points to the next node in the list, which of the following is true for the following piece of code:
for (p=head, q = head; p!=NULL; q = p)
{
p = p->next;
free(q);
}
ADeletes all nodes
BDeletes all but the last node
CDoes not delete any node
DThe program will crash
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
No Discussion on this question yet!