#include
struct student//////////结构体定义
{int no;
float grade;
struct student *next;};
int n;
struct student*head,*p;
struct student*creat()//////////定义输入函数
{
struct student*head;
struct student*p1,*p2;
n=0;
p1=p2=(struct student*)malloc(sizeof(struct student)); //这里要加强制转换
scanf(" %ld,%f",&p1->no,&p1->grade);
head=NULL;
while(p1->no!=0)
{n=n+1;
if(n==1)
head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student*)malloc(sizeof(struct student));//这里要加强制转换
scanf(" %ld,%f",&p1->no,&p1->grade);//sco改为grade
}
p2->next=NULL;
请检查13-14行,head为空指针!!然后把NULL赋值给p,p没有指向!