union data1 /*共同体*/
{
int i;
float f;
char ch;
};
struct data2 /*结构体*/
{
int i;
float f;
char ch;
};
main()
{
printf(“分别输出共同体和结构体的大小:\n”);
printf("%d,%d\n",sizeof(union data1),sizeof(struct data2));
}
{
int i;
float f;
char ch;
};
struct data2 /*结构体*/
{
int i;
float f;
char ch;
};
main()
{
printf(“分别输出共同体和结构体的大小:\n”);
printf("%d,%d\n",sizeof(union data1),sizeof(struct data2));
}