问题描述
class Data {
double a,b,c;
};
int main() {
Data x,y,z;
cout << sizeof(x) << endl;
cout << &x << " " << &y << " " << &z << endl;
}
24
0x7ffd911f5640 0x7ffd911f5660 0x7ffd911f5680
这是我的问题: Data 类对象只需要 24 个字节的空间,那么为什么编译器为每个对象分配了 32 个字节(0x7ffd911f5640
和 0x7ffd911f5660
之间的内存空间)对象?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)