林不 「即」 新的C,但可以有一個人請賜教在這一個:的sizeof結構的sizeof VS型
printf("%d %d\n", sizeof(int), sizeof(unsigned char));
打印預期4和1
typedef struct
{
int a;
unsigned char b;
} test
printf("%d\n", sizeof(test));
打印8 ...我真的很困惑!
林不 「即」 新的C,但可以有一個人請賜教在這一個:的sizeof結構的sizeof VS型
printf("%d %d\n", sizeof(int), sizeof(unsigned char));
打印預期4和1
typedef struct
{
int a;
unsigned char b;
} test
printf("%d\n", sizeof(test));
打印8 ...我真的很困惑!
http://en.wikipedia.org/wiki/Data_structure_alignment#Data_structure_padding – Mysticial 2012-03-12 00:45:12