fork download
  1. #include<stdio.h>
  2. struct node{
  3. int i;
  4. struct node *link;
  5. };
  6. int main()
  7. {
  8.  
  9. int a;
  10.  
  11. struct node *new=(struct node*) malloc(sizeof(struct node));
  12. new->i=1;
  13. new->link=NULL;
  14.  
  15. struct node *new1=(struct node*) malloc(sizeof(struct node));
  16. new1->i=2;
  17. new1->link=new;
  18.  
  19. struct node *new2=(struct node*) malloc(sizeof(struct node));
  20. new2->i=3;
  21. new2->link=new1;
  22.  
  23. struct node *temp;
  24. temp=new2;
  25. temp = temp->link;
  26.  
  27. printf("%d",temp->i);
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 2112KB
stdin
Standard input is empty
stdout
2