//联合体的关键字:union
//结构体的关键字:struct
//枚举的关键:enum
struct s
{
char c;//0
//1~3 浪费了
int i;//4~7
};
union un//联合体的声明
{
char c;
int i;
};
int main()
{
printf("%zd\n", sizeof(struct s));//8
printf("%zd\n", sizeof(union un));//4
return 0;
}
2024-06-10 07:15:29
//联合体的关键字:union
//结构体的关键字:struct
//枚举的关键:enum
struct s
{
char c;//0
//1~3 浪费了
int i;//4~7
};
union un//联合体的声明
{
char c;
int i;
};
int main()
{
printf("%zd\n", sizeof(struct s));//8
printf("%zd\n", sizeof(union un));//4
return 0;
}