The program was compiled normally,but catch below error while runing it.

oldhunter oldhunter 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include <malloc.h>
#define NULL 0
#define LEN sizeof(struct student)
struct student
{
int num;
float score;
struct student *next;
};

main()
{
struct student *creat(void);
void print(struct student *);
struct student *p;
p = creat();
print(p);
}

struct student * creat(void)
{
struct student *head,*p1,*p2;
int n=0;
p1 = p2 = (struct student *) malloc(LEN);
scanf("%d,%f", &p1->num, &p1->score);

head = NULL;
while(p1->num != 0)
{
++n;
if (n==1)
head = p1;
else
p2->next = p1;
p2 = p1;

p1 = (struct student *)malloc(LEN);
scanf("%d,%f", &p1->num, &p1->score);
}

p2->next = NULL;

return head;
}

void print(struct student *p)
{
while(p != NULL)
{
printf("num: %d\tscore: %.2f\n", p->num, p->score);
p = (*p).next;
}
}


The program was compiled normally,but catch below error while runing it.

floating point formats not linked
Abnormal program termination.
...全文

相关推荐

评论 14
收藏 已收藏
分享
返回顶部
oldhunter
C语言 70,040 成员 243,237 内容