c语言 链表的题 帮帮忙 那儿错了??

来源:百度知道 编辑:UC知道 时间:2024/05/17 19:29:32
#include <stdio.h>
#include <malloc.h>
#define NULL 0
#define LEN sizeof(struct student)
struct student
{long num;
float score;
struct student *next;
};
int n;
struct student *creat()
{struct student *p1,*p2,*head;
n=0;
head=NULL;
p1=(struct student *)malloc(LEN);
scanf("%ld,%f",&p1->num,&p1->score);
p1->next=NULL;
while(p1->num!=0)
{n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%ld,%f",&p1->num,&p1->score);
p1->next=NULL;
}
return(head);
}
void print(struct student *head)
{struct student *p;
printf("\nnow %d nuum\n",n);
p=head;
if(head!=NULL)
do
{printf("%ld %f\n",p->num,p->score);
p=p->next;
}while(p!=NULL);
}
main()<

呃....

creat函数里有一句n=n+1; ....
这个分号是中文的分号....
你程序包括输出都全是英文,不知道这个中文符号怎么来的.....

你编译的时候编译器应该有给出提示的..