Cの共用体
/*共用体のテストプログラム*/ #include <stdio.h> struct c_byte{ char low; char high; }; /* 共用体宣言 */ union{ short x; struct c_byte xbyte; }u_x; main(){ printf("16進数を入力(4ケタ) :"); scanf("%04x", &u_x.x); printf("\n 入力された数(16進数) %04x", u_x.x); printf("\n 上位バイト %02x : 下位バイト %02x ", u_x.xbyte.high, u_x.xbyte.low); }