Which of the following is the correct declaration of linked list?
2018
Which of the following is the correct declaration of linked list?
- A.
struct node*
{
int data;
node* link;
};
- B.
struct node
{
int data;
struct node* link;
};
- C.
struct node
{
int data;
node link;
};
- D.
struct node*
{
int data;
struct node* link;
};
Attempted by 842 students.
Show answer & explanation
Correct answer: B
A linked list stores data elements in nodes, where each node contains: A data field