#include <iostream>
using namespace std;
struct st1
{
char a ;
int b ;
short c ;
};
struct st2
{
short c ;
char a ;
int b ;
};
int main()
{
cout<<"sizeof(st1) is "<<sizeof(st1)<<endl; //sizeof(st1) is 12
cout<<"sizeof(st2) is "<<sizeof(st2)<<endl; //sizeof(st2) is 8
return 0 ;
}
原文:https://www.cnblogs.com/zongqingmeng/p/14620740.html