一.一般类型
约定为32位系统,即char 1字节、short 2字节、int 4字节,指针是地址4个字节
定义:偏移量
偏移量指的是结构体变量中成员的地址和结构体变量地址的差。结构体大小等于最后一个成员的偏移量加上最后一个成员的大小
struct note
{
int a;----0偏移量
char b;----4+0偏移量
short c;----1+4偏移量,但要是short的整数倍,所以得补1位
}note1;
sizeof(note1) = 2(short长度) + 6(偏移量) = 8;
二.内嵌结构体
struct note
{
char a;----0偏移量
struct date
{
short c;----1&