≡ Menu

Indicate how the pointers are used to establish a link between nodes

You are Here: Home > Computer Subjects > Programming in C Language > …

Indicate how the pointers are used to establish a link between nodes.

Ans. A node is used to create linked data structure like Linked list. A node has one data field and one or more link fields to other nodes. The pointer concept is used to link to nodes.

In C++, a node can be implemented by defining either a structure or class:

struct Node                               class Node
{                                             {
     int data;                                    private:
     Node *link;                                           int data;
}                                                             Node *link;
                                              };
  ----------      ----------       ----------
| data | o--|--->| data | o--|--->|  data | o |
  ----------      ----------       ----------

Click Here to Find Latest Jobs and Current Affairs
{ 0 comments… add one }

Leave a Comment