#include<stdio.h>
#include<stdlib.h>
typedef struct LIST
{
int data;
struct LIST *next;
} node;
int count=0;
node *creat()
{
int i;
node *phead,*p,*q;
phead=NULL;
p=phead;
q=(node *)malloc(sizeof(node));
scanf("%d",&q->data);
while(p->data!=0)
{
count++;
p->next=q;
q->next=NULL;
p=q;
q=(node *)malloc(sizeof(node));
scanf("%d",&q->data);
}
return phead;
}
void *paint(node *phead)
{
node *p;
p=phead;
p=p->next;
for(int i=0;i<count;i++);
{
printf("%d",p->data);
printf("\n");
p=p->next;
}
}
int main()
{
node *phead;
phead=creat();
paint(phead);
return 0;
}
#include<stdlib.h>
typedef struct LIST
{
int data;
struct LIST *next;
} node;
int count=0;
node *creat()
{
int i;
node *phead,*p,*q;
phead=NULL;
p=phead;
q=(node *)malloc(sizeof(node));
scanf("%d",&q->data);
while(p->data!=0)
{
count++;
p->next=q;
q->next=NULL;
p=q;
q=(node *)malloc(sizeof(node));
scanf("%d",&q->data);
}
return phead;
}
void *paint(node *phead)
{
node *p;
p=phead;
p=p->next;
for(int i=0;i<count;i++);
{
printf("%d",p->data);
printf("\n");
p=p->next;
}
}
int main()
{
node *phead;
phead=creat();
paint(phead);
return 0;
}