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
Related Questions on Structure and Union
Which of the following can be a member of a structure?
A. Function
B. Another structure
C. Enumeration
D. All of the above

Join The Discussion