int n;
struct list * creat(void)
{
struct list * head;
struct list * p1,* p2;
int i;
head=(struct list *)malloc(LEN);
scanf("%d",&n);
head->next=NULL;
p2=head;
for(i=0;i<n;i++)
{
p1=(struct list *)malloc(LEN);
scanf("%d",&p1->num);
p1->next=NULL;
p2->next=p1;
p2=p1;
}
return head;
}
void print(struct list * head)
{
struct list * p;
p=head;
if(head!=NULL)
do
{
printf("%d ",p->num);
p=p->next;
}while(p!=NULL);
printf("\n");
}![](http://imgsrc.baidu.com/forum/w%3D580/sign=b941f584b6fd5266a72b3c1c9b199799/9a8cb31c8701a18bbf5ceb209e2f07082938fe86.jpg)
struct list * creat(void)
{
struct list * head;
struct list * p1,* p2;
int i;
head=(struct list *)malloc(LEN);
scanf("%d",&n);
head->next=NULL;
p2=head;
for(i=0;i<n;i++)
{
p1=(struct list *)malloc(LEN);
scanf("%d",&p1->num);
p1->next=NULL;
p2->next=p1;
p2=p1;
}
return head;
}
void print(struct list * head)
{
struct list * p;
p=head;
if(head!=NULL)
do
{
printf("%d ",p->num);
p=p->next;
}while(p!=NULL);
printf("\n");
}
![](http://imgsrc.baidu.com/forum/w%3D580/sign=b941f584b6fd5266a72b3c1c9b199799/9a8cb31c8701a18bbf5ceb209e2f07082938fe86.jpg)