Advertisement
province_rehan

Untitled

Feb 21st, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. struct node{
  4. int x;
  5. char y;
  6. struct node*p ;
  7. };
  8. struct node*ptr,*head,*first;
  9. int main(){
  10. int i,k=1;
  11. char l='a';
  12. head=ptr;
  13. ptr=(struct node*)malloc(sizeof(struct node));
  14. for(i=0;i<26;i++){
  15. ptr->x=k++;
  16. ptr->y=l++;
  17. printf("%d %c\n",ptr->x,ptr->y);
  18. ptr->p=(struct node*)malloc(sizeof(struct node));
  19. ptr= ptr->p;
  20. }
  21. ptr->p=NULL;
  22. ptr=head;
  23. first=(struct node*)malloc(sizeof(struct node));
  24.  
  25. first->x=27;
  26. first->y='A';
  27. first->p=ptr;
  28. head=first;
  29. printf("%d %c\n",ptr->x,ptr->y);
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement