1 typedef struct bb 2 { 3 int id; //[0]....[3] 4 double weight; //[8].....[15] 原则1 5 float height; //[16]..[19],总长要为8的整数倍,补齐[20]...[23] 原则3 6 }BB; 7 typedef struct aa 8 { 9 char name[2]; //[0],[1] 10 int id; //[4]...[7] 原则1 11 double score; //[8]....[15] 12 short grade; //[16],[17] 13 BB b; //[24]......[47] 原则2 14 }AA; 15 int main() 16 { 17 AA a; 18 cout<<sizeof(a)<<" "<<sizeof(BB)<<endl; 19 return 0; 20 }