C Quiz – 108 | Question 2

Anyone of the followings can be used to declare a node for a singly linked list. If we use the first declaration, “struct node * nodePtr;” would be used to declare pointer to a node. If we use the second declaration, “NODEPTR nodePtr;” can be used to declare pointer to a node.

filter_none

edit
close

play_arrow

link
brightness_4
code

/* First declaration */
struct node {
int data;
struct node * nextPtr;
};
  
/* Second declaration */
typedef struct node{
int data;
NODEPTR nextPtr;
} * NODEPTR;

chevron_right


(A) TRUE
(B) FALSE


Answer: (B)

Explanation: The typedef usage is incorrect. Basically, we can’t use yet to be typedef-ed data type inside while applying typedef itself. Here, NODEPTR is yet to be defined (i.e. typedef-ed) and we are using NODEPTR inside the struct itself.

Quiz of this Question

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

My Personal Notes arrow_drop_up
Article Tags :
Practice Tags :


1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.