可能重複:
Why isn't sizeof for a struct equal to the sum of sizeof of each member?C中struct mem如何?
我無法理解結構MEM頁頭。
typedef struct a{
} a;
sizeof(a) is 0
typedef struct b{
int bb
} b;
sizeof(b) is 4
typedef struct b2{
int *bbbb
} b2;
sizeof(b2) is 8
typedef struct d{
int x;
int *y;
} d;
sizeof(d) is 16!
爲什麼sizeof是16?是12?(int + int point = 4 + 8);
我估計sizeof(int)是4,如果int var在struct中,mem是8?
http://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member –