单选题
有以下程序:
#include <stdio.h>
main()
union
charch[2];
int d;
s;
s.d=0x4321;
printf("%x,%x/n",s.ch[0],s.ch[1]);
在16位编译系统上,程序执行后的输出结果是( )。
A、
21,43
B、
43,21
C、
43,00
D、
21,00
【正确答案】
A
【答案解析】
[解析] int型变量和字符数组ch共用两个字节的存储单元,通常ch[0]位于低字节, ch[1]位于高字节,所以s.ch[0]=21,s.c[1]=43。
提交答案
关闭