#include <stdio.h>
//步骤:1.上下对齐 2.整体对齐
int main(int argc, const char * argv[]) { //结构体大小的计算方法 struct student{ int a; // 4 char b; // 1+4=5 +3=8 double c;//8+8=16 float e;//4+16=20 short f;//2+20=22 +2 =24 }; struct student s; printf("%ld",sizeof(s)); return 0; }
|