full singly linkedlist

PHOTO EMBED

Wed Oct 16 2024 16:37:09 GMT+0000 (Coordinated Universal Time)

Saved by @E23CSEU1151

#include <iostream> 
using namespace std;

struct node{
    int data;
    struct node* next;
};
int main()
{
    node* head = new node;
    head-> data = 10;
    head-> next = NULL;
    cout << "1st node is "<< head-> data << endl;
    
    node* current = new node;
    current-> data = 20;
    current-> next = NULL;
    head-> next = current;
    cout << "1st node is "<< current-> data << endl;
    
    
    current-> data = 30;
    current-> next = NULL;
    head-> next ->next = current;
    cout << "3rd node is "<< current-> data << endl;
    
    
    
}
content_copyCOPY