Discussion
Anyone of the following can be used to declare a node for a singly linked list and “NODEPTR nodePtr;” can be used to declare pointer to a node using any of the following
/* First declaration */
typedef struct node
{
int data;
struct node *nextPtr;
}* NODEPTR;
/* Second declaration */
struct node
{
int data;
struct node * nextPtr;
};
typedef struct node * NODEPTR;
Answer: A
Correct answer: TRUE
Both work. In the first, the member is declared as struct node *nextPtr - the tag is available inside its own definition, even though the typedef name is not - and NODEPTR is defined by the same declaration. In the second, the structure is completed first and the typedef written afterwards. Either way NODEPTR nodePtr; declares a pointer to a node.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development