#include <stdio.h>
typedef struct
{
int a;
char c;
int d;
}t;
typedef struct
{
int a;
char c;
char d;
char e;
int f;
}t1;
int main()
{
printf("sizeof t = %d", sizeof(t));
printf("sizeof t1 = %d", sizeof(t1));
}
输出:
sizeof t = 12
sizeof t = 12
不使用#pragma pack(),sizeof运算符为两个不同的结构返回相同的值。你能解释一下吗?