#include<stdio.h>
#include<stdlib.h>
struct Test
{
int data;
struct Test *next;
};
void printLink(struct Test *head)
{
while(head != NULL)
{
printf("%d ",head->data);
head = head->next;
}
}
struct Test *inPutData(struct Test *head)
{
struct Test *new;
while(1)
{
new = (struct Test *)malloc(sizeof(struct Test));
printf("input your new data\n");
scanf("%d",&(new->data));
if(new->data == 0)
{
printf("0 quit\n");
return head;
}
if(head == NULL)
{
head = new;
}else
{
new->next = head;
head = new;
}
}
}
int main()
{
struct Test *head = NULL;
head = inPutData(head);
printLink(head);
return 0;
}