C 语言程序异常中断

来源:百度知道 编辑:UC知道 时间:2024/05/17 23:07:51
这是一个链表程序,能对起进行建表,删除,添加等操作,编译正常,但在运行时会提示:scanf : floating point formats not linked
abnormal program termination
整个程序如下:
#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(void)
{
struct student * head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student *) malloc(LEN);
scanf("%ld,%f",&p1->num,&p1->score);
head=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);
}
p2->next=NULL;
return(head);
}

void print(struct student * head)
{
struct student * p;
printf("\nNow,these %d re

太长了吧大哥,等我慢慢看来

请参阅:

http://zhidao.baidu.com/question/9300333.html

我刚刚回答的!!!