大家来看看这个程序 最好给我讲解一下,错在哪边?谢谢大侠指点;主要是讲解?
#include "stdio.h"struct student {
int num;
float score;
struct student *next;
};
struct student *creat();
main(){
struct student *head;
head=creat();
}
struct student *creat(){
struct student *head,*tail,*p;
float score;
int num,size=sizeof(struct student);
head=tail=NULL;
scanf("%d%f",&num,&score);
while(num){
p=(struct student *)malloc(size);
p->num=num;
p->score=score;
p->next=NULL;
if(head==NULL) head=p;
else tail->next=p;
tail=p;
scanf("%d%f",&num,&score);
}
return head;
}
[[it] 本帖最后由 wa5000 于 2009-8-3 03:05 编辑 [/it]]