Question 60

Which of the following is the correct declaration of linked list?

  1. AStruct node* { int data; node * link; }
  2. BStruct node { int data; struct node* link; }
  3. CStruct node { int data; node link; }
  4. DStruct node* { int data; struct node* link; }
Show answerHide answer

Correct answer: (B) Struct node { int data; struct node* link; }

Explanation

A self-referential structure has a pointer to its own type: struct node { int data; struct node *link; };. A member of type node itself would be infinitely recursive.

From DSSSB TGT Computer Science Practice Set 4

This is question 60 of DSSSB TGT Computer Science Practice Set 4. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.