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 main() {
  12. struct node *tail;
  13. struct node *temp;
  14. struct node *counter;
  15.  
  16. counter=tail;
  17. do{
  18. printf("Enter data, 0 to quit ");
  19. scanf("%d",&temp->x);
  20. temp->next=NULL;
  21. counter->next=temp;
  22. counter=temp;
  23.  
  24. }while(temp->x!=0);
  25.  
  26. getchar();
  27. return 0;
  28. }
  29.  
  30.