请教:class的内存分配问题
- C/C++ code
#include<iostream>using namespace std;class Employee{private: //static int base; char Id[10]; int salary;public: };void main(){ cout<<sizeof(Employee)<<endl;}为什么答案是16呀?[解决办法]
字节对齐
google一下
int的开始位置必须是4的倍数的位置