C语言struct student

2025-02-23 12:30:01
推荐回答(2个)
回答1:

struct student
{
int num; //4个字节
char name[20];
char sex; //也要为4个字节(4个字节对齐)
int age;
float score;
char addr[30];
}student1,student2;

这是结构体,应该放在主函数外面。
还有系统的字对齐问题,

回答2:

结构体应该放在主函数的外面的