strct-pack-4.c

来自「this is a gcc file, you can download it 」· C语言 代码 · 共 30 行

C
30
字号
typedef struct{  unsigned char a __attribute__((packed));  unsigned short b __attribute__((packed));} three_char_t;unsigned charmy_set_a (void){  return 0xab;}unsigned shortmy_set_b (void){  return 0x1234;}main (){  three_char_t three_char;  three_char.a = my_set_a ();  three_char.b = my_set_b ();  if (three_char.a != 0xab || three_char.b != 0x1234)    abort ();  exit (0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?