????1.???????
???????磺struct TEST
????{
????char a;
????int b;
????char c;
????}
???????????sizeof??ó?????? 12?? ????????????4byte?? ????a???1byte?????3???????????????b???????a??????4byte?? ????c????????????????? ?????4byte????sizeof??12??
#include "stdafx.h"
#include <iostream>
using namespace std;
struct TEST1    //12
{
char a;
int b;
char c;
};
struct TEST2    //8
{
char a;
char b;
int c;
};
struct TEST3    //8
{
char a;
char b;
char c;
int d;
};
struct TEST4    //12
{
char a[5];
int b;
};
struct TEST5    //8 + 8 + 8 = 24
{
double a; //8
char b; //4
int c; //4??location the b memery
char d[5]; //5
};
int _tmain(int argc?? _TCHAR* argv[])
{
struct TEST1 t1;
struct TEST2 t2;
struct TEST3 t3;
struct TEST4 t4;
struct TEST5 t5;
cout << sizeof(t1) << endl << sizeof(t2) << endl;
cout << sizeof(t3) << endl << sizeof(t4) << endl << sizeof(t5) << endl;
return 0;
}