1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <math.h>
  5.  
  6. struct node{
  7. int x;
  8. struct node *next;
  9. };
  10.  
  11. int i,num;
  12.  
  13. int main() {
  14. struct node *tail;
  15. struct node *temp;
  16. struct node *counter;
  17. struct node *conductor;
  18. printf("How much data do you have to enter? ");
  19. scanf("%d",&num);
  20.  
  21.  
  22.  
  23. tail=(struct node *)malloc(sizeof(struct node));
  24. counter=tail;
  25. tail->x=21;
  26.  
  27. do{
  28. temp=(struct node *)malloc(sizeof(struct node));
  29. printf("Enter data ");
  30. scanf("%d",&temp->x);
  31. temp->next=NULL;
  32. counter->next=temp;
  33. counter=temp;
  34. free(temp);
  35. i++;
  36. }while(i<num);
  37.  
  38. conductor=tail;
  39. printf("%d",conductor->next);
  40. while (conductor->next!=NULL){
  41. printf("%d",conductor->x);
  42. conductor=conductor->next;}
  43.  
  44.  
  45. getchar();
  46. return 0;
  47. }
  48.  
  49.