为什么会显示错误?
struct student* creat(){
struct student* phead=NULL;
struct student* pent,*pnew;
icount=0;
pent=pnew=(struct student*)malloc(sizeof(struct sudent));
printf("首先输入姓名,然后输入学号\n");
scanf("%s",&pnew->cname);
scanf("%d",&pnew->inumber);
while(pnew->inumber!=0)
{
icount++;
if(icount==1)
{
pnew->pnext=phead;
pend=pnew;
phead=pnew;
}
else
{
pnew->pnext=NULL;
pend->pnext=pnew;
pend=pnew;
}
pnew=(struct studnet*)malloc(sizeof(struct student));
scanf("%s",&pnew->cname);
scanf("%d",&pnew->inumber);
}
free(pnew);
return phead;
}