Which of the following will stop the loop at the last node of a linked list in the following C code snippet?
struct node
{
struct node *next;
};
struct node
{
struct node *next;
};A.
while (p != NULL)
{
p = p->next;
}B.
while (p->next != NULL)
{
p = p->next;
}C.
while (1)
{
p = p->next;
if (p == NULL)
break;
}D. All of the mentioned
Answer: Option B

Join The Discussion