Advertisement
apl-mhd

struct

Feb 20th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. struct list{
  6.     int data;
  7.     struct list *next;
  8.  
  9. };
  10.  
  11. typedef struct list node;
  12.  
  13. int main()
  14. {
  15.  
  16.    node *start, *temp, *prev, *temp1, *head;
  17.    start = new node();
  18.  
  19.    start->data = 10;
  20.  
  21.    temp = new node();
  22.  
  23.    temp->data = 20;
  24.    start->next = temp;
  25.  
  26.    temp = new node();
  27.    start->next->next = temp;
  28.    start->next->next->data = 30;
  29.     start->next->next->next = start;
  30.    // printf("%d",start->next->next->next->data);
  31.  
  32.    // head = new node();
  33.  
  34.   //  head->next = start->next->next;
  35.    // head->next = start;
  36.    // start = head();
  37.  
  38.   printf("%d",start->data);
  39.  
  40.  
  41.  
  42.  
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement