Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. typedef struct Node
  4. {
  5.     double y;
  6.     char x;
  7.     struct Node*next;
  8. }node;
  9. int main()
  10. {
  11.     node*head=(node*)malloc(sizeof(node));
  12.     head->x='A';
  13.     head->y=7.99;
  14.  
  15.     head->next=(node*)malloc(sizeof(node));
  16.     head->next->x='Z';
  17.     head->next->y=2.05;
  18.  
  19.     head->next->next=(node*)malloc(sizeof(node));
  20.     head->next->next->x='X';
  21.     head->next->next->y=3.69;
  22.  
  23.     head->next->next->next=NULL;
  24.  
  25.     node*current=head;
  26.     while(current!=NULL)
  27.     {
  28.         printf("%c %d\n", current->x, current->y);
  29.         current=current->next;
  30.     }
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement