char *name; short int data; char ha;
short ba[5]; }*p;
p=0x1000000; p+0x200=____; (Ulong)p+0x200=____; (char*)p+0x200=____;
希望各位达人给出答案和原因,谢谢拉 解答:假设在32位CPU上, sizeof(long) = 4 bytes
sizeof(char *) = 4 bytes
sizeof(short int) = sizeof(short) = 2 bytes sizeof(char) = 1 bytes
由于是4字节对齐,
sizeof(struct BBB) = sizeof(*p)
= 4 + 4 + 2 + 1 + 1/*补齐*/ + 2*5 + 2/*补齐*/ = 24 bytes (经Dev-C++验证)
p=0x1000000;
p+0x200=____;
= 0x1000000 + 0x200*24
(Ulong)p+0x200=____; = 0x1000000 + 0x200
(char*)p+0x200=____; = 0x10000