char类型:
char cPos;
unsigned char ucPos;
char str[] = "Hello" ;
char *pChar = str;
char *pCharArray[10][10];
cout <<"char:"<<sizeof(cPos)<< endl;//1
cout <<"unsigned char:"<<sizeof(ucPos)<< endl;//1
cout <<"str[]:"<<sizeof(str)<< endl;//6
cout <<"*pCharArray[10][10]:"<<sizeof(pCharArray)<< endl;//400
short类型
short sClass;
unsigned short usClass;
short sLevel[6];
cout <<"short:"<<sizeof(sClass)<< endl;//2
cout <<"unsigned short:"<<sizeof(usClass)<< endl;//2
cout <<"short sLevel[6]:"<<sizeof(sLevel)<< endl;//12
long类型
long lIndex;
unsigned long ulGrade;
cout <<"long:"<<sizeof(lIndex)<< endl;//4
cout <<"unsigned long:"<<sizeof(ulGrade)<< endl;//4
double类型
double dWeight;
long double ldWeight;
cout <<"double:"<<sizeof(dWeight)<< endl;//8
cout <<"long double:"<<sizeof(ldWeight)<< endl;//12
int类型
int pi;
unsigned int upi;
cout <<"int:"<<sizeof(pi)<< endl;//4
cout <<"unsigned int:"<<sizeof(upi)<< endl;//4
union类型
typedef union record
{
long lIndex;
short sLevel[6];
char cPos;
} REC_S;
typedef union empty
{} EMPTY;
cout <<"union record:"<<sizeof(stMax)<< endl;//12
cout <<"union *pMax:"<<sizeof(pMax)<< endl;//4
cout <<"union empty:"<<sizeof(em)<< endl;//1
cout <<"union *emp:"<<sizeof(emp)<< endl;//4
struct类型,有点复杂,对字节对齐还不太熟悉,继续了解