谁帮我解释一下这个代码# Programming - 葵花宝典
c*g
1 楼
#include
#include
main(){
typedef union {
int a;
char b[10];
float c;
}
Union;
Union x,y ={100};
x.a = 50;
strcpy(x.b,"hello");
x.c = 21.50;
printf("Union x: %d %s %f \n",x.a,x.b,x.c);
printf("Union y: %d %s %f \n",y.a,y.b,y.c);
}
为什么我的输出是
Union x: 1101791232 21.500000
Union y: 100 d 0.000000
#include
main(){
typedef union {
int a;
char b[10];
float c;
}
Union;
Union x,y ={100};
x.a = 50;
strcpy(x.b,"hello");
x.c = 21.50;
printf("Union x: %d %s %f \n",x.a,x.b,x.c);
printf("Union y: %d %s %f \n",y.a,y.b,y.c);
}
为什么我的输出是
Union x: 1101791232 21.500000
Union y: 100 d 0.000000