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
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
相关文章推荐
- 如何获取Java中内存对象的大小? sizeof = ?
- 如何优化cocos2d/x程序的内存使用和程序大小
- 给两个数组和他们的大小,还有一动态开辟的内存,求交集,把交集放到动态内存dongtai,并且返回交集个数
- 启动过程内存check和vmalloc大小设置
- IOS 调整内存中的图片大小实例详解
- vector_construct_interator;delete为什么能识别free内存大小
- 结构体在内存中所占空间大小的计算
- 更改SQL Server最大内存大小导致不能启动的解决方法
- C++(虚)继承类的内存占用大小
- [StructLayout(LayoutKind.Sequential)]struct实例字段的内存布局(Layout)和大小(Size)
- 如何优化cocos2d/x程序的内存使用和程序大小【第一部分】
- MyEclipse 或 Eclipse 调使用内存的大小
- eclipse修改内存大小
- 修改tomcat内存大小
- Eclipse 中修改tomcat设置内存大小
- kernel中如何读取内存的大小和地址
- Linux以百万兆字节显示内存大小
- tomcat 内存大小配置
- Nginx缓存区内存配置大小对性能测试的影响
- tomcat内存大小设置