请问前辈这段程序到底是哪出错了
#include<stdio.h>#include<stdlib.h>
#define LEN sizeof(struct xuesheng);
struct xuesheng
{
long xuehao;
float chengji;
struct xuesheng *next;
};
int main(void)
{
struct xuesheng *p1,*p2,*head;
int n;
head=NULL;
p1=p2=(struct xuesheng *)malloc(LEN);
scanf("%ld %f",p1->xuehao,p2->chengji);
while(p1->xuehao!=0)
{
++n;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct xuesheng *)malloc(LEN);
scanf("%ld %f",p1->xuehao,p1->chengji);
}
p2->next=NULL;
return 0;
}