Anik_Akash

Link list Block Creat

Feb 14th, 2021 (edited)
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace    std;
  3.  
  4. typedef struct INFO {
  5.     int Roll;
  6.     string name;
  7.     struct INFO *next;
  8. }info;
  9.  
  10. int main()
  11. {
  12.     info *ptr, *ptr1;
  13.  
  14.     ptr = (info*) malloc(sizeof(info));
  15.     ptr ->Roll = 7;
  16.     ptr ->name = "Anik";
  17.     ptr->next = NULL;
  18.  
  19.     ptr1 = (info*) malloc(sizeof(info));
  20.     ptr1 ->Roll = 10;
  21.     ptr1 ->name = "Akash";
  22.     ptr1->next = NULL;
  23.  
  24.     ptr->next = ptr1;
  25.  
  26.     cout<<ptr->Roll<<" "<<ptr->name<<endl;
  27.     cout<<ptr1->Roll<<" "<<ptr1->name<<endl;
  28.     return 0;
  29. }
  30.  
Add Comment
Please, Sign In to add comment