1 typedef struct AA{ 2 int aa1; //[0]....[3] 3 double aa2; //[8].....[15] 4 float aa3; //[16]..[19] 原则3:结构体总大小,总长要为8的整数倍,补齐[20]...[23] 5 }; 6 typedef struct BB 7 { 8 char bb1[2]; //[0],[1] 9 int bb2; //[4]...[7] 10 double bb3; //[8]....[15] 11 short bb4; //[16],[17] 12 AA a; //[24]......[47] 原则2,内部对象为结构体 13 };
1 24 48
1 union mm{ 2 char a; //元长 度1 3 int b[5];//元长度4 4 double c;//元长度8 5 int d[3]; 6 };