#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; }
原创文章,作者:carmelaweatherly,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/245000.html