我定义了如下代码,有谁可以告诉我为什么结果是
#include
typedef struct _my_stru_1{
char a;
double b;
}my_stru_1;
typedef struct _my_stru_2{
double a;
char b;
double c;
}my_stru_2;
void main()
{
my_stru_1 a;
my_stru_2 b;
printf("the size of my_stru_1: %d\n",sizeof(a) );
printf("the size of my_stru_2: %d\n",sizeof(b) );
}
运行结构是 结构2的大小是24;结构1的大小是12;结构1的大小我理解,但结构2为什么会是24呢?请大侠赐教!