为什么一个成员也没有的struct也占八个字节
#include <stdio.h>
#pragma hdrstop
struct A{
};
//---------------------------------------------------------------------------
#pragma argsused
int main(int argc, char* argv[])
{
printf("the length of A is %d bytes",sizeof(struct A*));
return 0;
}我用上面的程序测试了一下
结果为8
而如果struct中有一个int的话结果居然为四。我真的搞不懂。没有成员的struct必有成员的struct占用的地方还多
我是用bcb的console wizard运行上面程序的。