Advertisement
apl-mhd

vejallaLinkedList

Jul 10th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3.  
  4. #define P printf("\n");
  5.  
  6. using namespace std;
  7.  
  8. struct node{
  9.    
  10.     int id=10;
  11.     bool mark;
  12.    
  13.     struct node *next[26];
  14.    
  15.     node(){
  16.        
  17.         mark=true;
  18.         for(int i=0; i<25; i++)
  19.             next[i]=NULL;
  20.        
  21.         }
  22.    
  23.    
  24.     };
  25.    
  26. struct list{
  27.    
  28.     int data;
  29.    
  30.     struct list *next;
  31.    
  32.     list(){
  33.        
  34.         next=NULL;
  35.         data=9999999;
  36.         }
  37.    
  38.     };
  39.    
  40.     typedef node node;
  41.     typedef list list;
  42.    
  43.    
  44. int main(int argc, char **argv)
  45. {
  46.    
  47.     list *a=new list();
  48.    
  49.     list *x =a;
  50.    
  51.     x->data=10;
  52.     x->next = new list();
  53.    
  54.     x = x->next;
  55.    
  56.     x->data=20;
  57.    
  58.     x->next =  new list();
  59.    
  60.     x= x->next;
  61.    
  62.    
  63.     cout<<a->data;
  64.     P;
  65.     cout<<a->next->next->data;
  66.    
  67.    
  68.     return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement