#include
#include
struct node
{
int num;
struct node*next;
};
void creatlist(struct node*p);
void printlist(struct node*p);
int main()
{
struct node*p;
creatlist(p);
printlist(p);
return 0;
}
void creatlist(struct node*p)
{
p=(struct node*)malloc(sizeof(struct node));
p->next=NULL;
scanf("%d",&p->num);
if(p->num==0)
return;
creatlist(p->next);
}
void printlist(struct node*p)
{
if(p!=NULL)
{
printf("%d ",p->num);
printlist(p->next);
}
}