Advertisement
Guest User

Untitled

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