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 = malloc(sizeof(struct node));
  24. counter = tail;
  25.  
  26. printf("Enter data ");
  27. scanf("%d",&tail->x);
  28. counter->next=NULL;
  29. while ( i < num-1 ) {
  30. temp = malloc(sizeof(struct node));
  31. printf ("Enter data ");
  32. scanf ("%d",&temp->x);
  33. temp->next = NULL;
  34. counter->next = temp;
  35. counter = temp;
  36. i++;
  37. };
  38.  
  39. conductor=tail;
  40. while ( conductor != NULL ) {
  41. printf("%d\n",conductor->x);
  42. conductor=conductor->next;
  43. }
  44.  
  45. return 0;
  46. }