关于c语言,这个程序c如果定义为float型就不能运行,定义为int型就可以运行,这是为什么?真心

2025-04-06 22:23:08
推荐回答(2个)
回答1:

你这是要链表的意思..上面程序都没完整
pNext 结构体指 struct student
还有scanf 输入时要地址类型的
printf给你输成peintf
#include
int main()
{
struct Student
{
int i;
char x[10];
float c;
struct Student *n;
}s[3];
struct Student *p1;
p1 = &s[0];
s[0].n = &s[1];
s[1].n = &s[2];
while (p1 != NULL)
{
scanf("%d",&p1->i);
scanf("%s",p1->x);
scanf("%f",&p1->c);
p1 = p1->n;
}
p1 = &s[0];
while (p1 != NULL)
{
printf("%d %s %f", p1->i, p1->x, p1->c);
p1 = p1->n;
}
}
意思是输入3个学生信息 再输出吧?我没测试完.. 你自己看看吧

回答2:

后面打/