[求助]关于用printf函数输出结构体变量的疑问
#include"stdio.h"#include"string.h"
void main()
{
struct student
{long num;
char name[20];
char sex;
float score;
};
struct student stu1;
sqrt(5.0); //告诉编译系统调入浮点运算库,没有其他用途
puts("\nPls input NO:");
scanf("%d",stu1.num);
puts("\nPls input name:");
scanf("%s",stu1.name);
puts("\nPls input sex:");
getchar(); //读入上次输入的结束字符
scanf("%c",stu1.sex);
puts("\nPls input score:");
scanf("%f",stu1.score);
printf("%d,%s,%c,%f",stu1.num,stu1.name,stu1.sex,stu1.score);//这个语句不能正常输出,若改为一个变量输出,则正常,希望高手们指正!多谢了!
}