zzy-c

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

 

 

 

 

 

 

 

 

#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;
}

 

 

posted on 2022-04-13 13:18  zzy_C  阅读(24)  评论(0)    收藏  举报