求帮忙看看这段C语言代码什么意思,关于从文件读取数据到链表的struct Student *createlist(){
struct Student *head,*p1,*p2;
struct Student temp;
p1=(struct Student * )malloc(LEN);
int i=1;
FILE *fp;
if ((fp=fopen ("shuju1.dat","rb"))==NULL){
printf("不能打开文件\n");
return;
}
while(fread(&temp,LEN,1,fp)!=0){
if (i==1) head=p1;
else p2->next=p1;
p2=p1;
p1->num=temp.num;
strcpy(p1->name,temp.name);
p1->yuwen=temp.yuwen;
p1->shuxue=temp.shuxue;
p1->yingyu=temp.yingyu;
p1=(struct Student * )malloc(LEN);
i=i+1;
}
p2->next=NULL;
fclose(fp);
return (head);
}
麻烦您讲讲else p2—>next那个怎么改改
追答#include <stdio.h>呃呃,改成这样运行不了了。。。