Advertisement
afrinahoque

LinkedList1

Sep 24th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. typedef struct node
  4. {
  5.     int a;
  6.     char ch;
  7.     struct node *next;
  8. }node;
  9. int main()
  10. {
  11.     node *N=(node*)malloc(sizeof(node));
  12.     scanf("%d", &N->a);
  13.     scanf(" %c", &N->ch);
  14.     N->next=NULL;
  15.  
  16.     node *p=(node*)malloc(sizeof(node));
  17.     scanf("%d", &p->a);
  18.     scanf(" %c", &p->ch);
  19.     p->next=NULL;
  20.  
  21.     N->next=p;
  22.  
  23.     printf("N:a:%d\n", N->a);
  24.     printf("N:ch:%c\n", N->ch);
  25.  
  26.     printf("\np:a:%d\n", p->a);
  27.     printf("p:ch:%c\n", p->ch);
  28.  
  29.     //printf("\np:a:%d\n", N->next->a);
  30.     //printf("p:ch:%c\n", N->next->ch);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement