struct node
{int data;
struct node *next;
};
struct node *create()
{
struct node *p;
p=(struct node *)malloc(sizeof(struct node));
p->next=0;
return p;
}
main()
{
struct node *head,*q,*p,*t;
int i;
int x;
head=create();
for(i=1;i<=10;i++)
{
printf("please input data:");
scanf("%d",&x);
q=create();
q->data=x;
if(i==1)
{
head->next=q;
p=q;
}
else
{p->next=q;
p=q;}
}
}
波斯汪
慕桂英3389331
相关分类