struct w{ char low;char high;};union u{ struct w byte;short word;}uw; main( ){ int resul

12 查阅

struct w

{ char low;

char high;

};

union u

{ struct w byte;

short word;

}uw;

main( )

{ int result;

uw.word=0x1234;

printf(“word value:%04x\n”,uw.word);

printf(“high byte:%02x\n”,uw.byte.high);

printf(“low byte:%02x\n”,uw.byte.low);

uw.byte.low=0x74;

printf(“word value:%04x\n”,uw.word);

result=uw.word+0x2a34;

printf(“the result:%04x\n”,result);

}

参考答案:

5.word value:1234

软考初级