#include <stdio.h>
#include <stdlib.h>
#include<malloc.h>
#define LEN sizeof(struct int_list)
struct int_list
{
int value;
struct int_list *next;
};
typedef struct int_list IntList;
int n;
struct int_list *creat()
{
struct int_list *head;
struct int_list *p1,*p2;
n=0;
p1=p2=(struct int_list *)malloc(LEN);
printf("Input:");
scanf("%d", &p1->value);
head=NULL;
while(p1->value!=0)
{
n=n+1;
if(n==1)head=p1;
else p2->next = p1;
p2=p1;
p1=(struct int_list*)malloc(LEN);
printf("Input:");
scanf("%d", &p1->value);
}
p2->next=NULL;
return(head);
}
void print(struct int_list *head)
{
struct int_list *p;
printf("out");
p=head;
if(head!=NULL)
do
{
printf("Output:");
printf("%d",p->value);
}while(p!=NULL);
}
int main ()
{
struct int_list *head;
head = creat();
print(head);
return 0;
}