#include<iostream>
using namespace std;
class Person
{
public:
double m_A;//double占用8字节
int m_B;//int占用4字节
};
void test01()
{
Person p;
cout<<"p占用内存大小为:"<<sizeof(p)<<endl;
}
int main()
{
test01();
system("pause");
return 0;
}
按道理应该p占用12个字节,为什么输出为16个字节呢?