Creation of Linked list using C++

/******************************************
This is the basic of linked list.
In this program we will know how
Create a linked list, store value
in node.
******************************************/

#include<iostream>
using namespace std;
struct Node     //Declaration of Node for linked list
{
    int data;
    struct Node* next;
};
int main()
{
    //Declare 3 Node type memory for linked list in heap

    struct Node* head;
    head=new(Node);
    Node* second=new(Node);
    Node* third=new(Node);

    //store the data and address of next node

    head->data=7;
    head->next=second;

    second->data=11;
    second->next=third;

    third->data=20;
    third->next=NULL;

    
    return 0;
}


Comments