结构体内存分配不一定是连续的:
struct A{
int a;
char b;
short c;
};
struct B{
char b;
int a;
short c;
};
其中一次以上两个结构体各个成员分配的地址如下:
A.a:0xbf86c148
A.b:0xbf86c14c
A.c:0xbf86c14e
B.a:0xbf86c140
B.b:0xbf86c13c
B.c:0xbf86c144
(CSDN第一滴记录...)