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

2018

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

  1. A.

    struct node*

    {

    int data;

    node* link;

    };

  2. B.

    struct node

    {

    int data;

    struct node* link;

    };

  3. C.

    struct node

    {

    int data;

    node link;

    };

  4. 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

Explore the full course: Up Lt Grade Assistant Teacher 2025