不同的排序相同的结构//我在主体功能使这些2层结构不同尺寸与类型研究
struct Book1
{
int genre;
int year;
char* author;
};
struct Book2
{
int genre;
char* author;
int year;
};
//我做“的sizeof()”两种结构。 //出于某种原因,Book1的大小为16字节,但Book2的大小为24字节 //为什么会发生这种情况? //顺便说一下,这是一个64位的Windows机器上,遵守使用Visual Studio 2012
int main(void)
{
int test1 = sizeof(struct Book1);
int test2 = sizeof(struct Book2);
return 0;
}
谢谢你澄清,这很有趣。 – 2013-04-28 22:17:20