您的位置:首页 > 编程语言 > C语言/C++

C++/C 内存大小

2014-03-28 08:50 141 查看
#include <stdio.h>

struct test1{
char a1;
int a2;
double a3;
};

struct test2{
char a1;
struct test1 t;
};

int main(void)
{
printf("%d\n",sizeof(struct test1));
printf("%d\n",sizeof(struct test2));

return 0;
}

用gcc编译 为16 20

用VC编译 为16 24
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: