输出时,只能输出第一个而且系统出错
#include <stdio.h>#include <stdlib.h>
int main()
{
struct Student
{
int a;
struct Student *next;
}s,*p=NULL,*q=NULL,*head=NULL;
head=p=&s;
q=p->next;
scanf("%d",&p->a);
while(p->a!=0)
{q=malloc(sizeof(struct Student));
p=q;
q=p->next;
scanf("%d",&p->a);
}
q=NULL;
p=head;
while(p->a)
{
printf("%d",p->a);
p=p->next;
}
}