C++中关于类的内存空间问题
#include<iostream>using namespace std;class Test{ public: void Show(){ cout<<"char in Test is:"<<c<<endl;} private: char c;};int main(){ Test test; cout<<"Size of Test is"<<sizeof(test)<<endl; return 0;}这个函数的执行结果是什么?我们老师说是4,可是我在很多编译器上的运行结果都是1,这个到底和“字节对齐”有关吗?请高手指点。