#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> //结构体的内存对齐 struct S { char c2; char c1; int i; }; struct S2 { double c2; int i; char c1; }; int main() { struct S s = { 0 }; struct S2 s2 = { 0 }; printf("%d\n", sizeof(s)); printf("%d\n", sizeof(s2)); return 0; }