C - Structures,Unions - Discussion

You Are Here :: Home > C > Structures,Unions - Discussion

 



Q.

For the following declaration of structure, which of the following will stop the loop at the last node of a linked list?

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
Explaination:

No Explanation



Discussion

Your Comments Goes here...
NameDiscussion