C++基本类型的大小
2011-07-21 15:25
288 查看
cout << "size of (char) : " << sizeof(char) << endl << "size of (int) : " << sizeof(int) << endl << "size of (unsigned int) : " << sizeof(unsigned int) << endl << "size of (long) : " << sizeof(long) << endl << "size of (unsigned long) : " << sizeof(unsigned long) << endl << "size of (float) : " << sizeof(float) << endl << "size of (double) : " << sizeof(double) << endl << "size of (short) : " << sizeof(short) << endl;
在vc 6.0上的结果是:
可以看出int 和 long 的大小在win32平台上是一样的。而C++标准只要求 sizeof(long) >= sizeof(int) >= sizeof(short) 即可。
另常见的typedef
#define UINT32 int
#define UINT unsigned int
#define DWORD unsigned long
#define LONG long
#define WORD unsigned short
#define BYTE char
相关文章推荐
- C#/Java/C/C++基本类型所占大小及表示范围
- 关于C和C++中的基本数据类型int、long、long long、float、double、char、string的大小及表示范围
- C/C++中基本数据类型在不同系统中所占空间大小
- c++中32位64位操作系统基本数据类型字节大小
- C#/Java/C/C++基本类型所占大小及表示范围
- C++ 基本语法之变量(指针)与数据类型(占用字节大小)
- C++ 基本类型所占空间大小
- c++基本数据类型大小
- C#/Java/C/C++基本类型所占大小及表示范围
- C++基本数据类型大小及表示范围
- 总结 C++中 基本内置类型 数据所占大小 和数据类型
- C++中基本的数据类型和所占的内存大小
- 关于C和C++中的基本数据类型int、long、long long、float、double、char、string的大小及表示范围
- C#/Java/C/C++基本类型所占大小及表示范围
- C++在不同操作系统的基本数据类型字节大小(转)
- c++ 基本类型大小
- C/C++中基本数据类型所占内存大小
- C/C++——基本数据类型的大小并且sizeof(int *) = 8
- C和C++中的基本数据类型的大小及表示范围详解
- Microsoft visual C++ 2010学习版中C语言基本数据类型所占字节大小(系统为64位win8.1)