union 公用体
union mytest
{
int n;
char a ;
short t;
} test;
test.n = 0x3E25AD54;
printf("test.n %-9X test.a %-9X test.t %-9X", test.n, test.a, test.t);
#输出结果是 test.n 3E25AD54 test.a 54 test.t FFFFAD54
double 占用8个字节
int 占用4个字节
short 占用2个字节
char 占用1个字节
网友评论