在C/C++中,int、char、double、long所占的字节数
来源:互联网 发布:淘宝0.01刷手机 编辑:程序博客网 时间:2024/05/23 21:34
所占字节数和机器字长及编译器有关:
所以,int
、long int
、short int
的宽度都可能随编译器而异。但有几条铁定的原则(ANSI/ISO
制定的):
sizeof(short int) <= sizeof(int)sizeof(int) <= sizeof(long int)short int至少为16bit(2byte)long int 至少应为32byte
16位编译器
char 1bytechar* 2byteshort int 2byteint 2byteunsigned int 2bytefloat 4bytedouble 8bytelong 4bytelong long 8byteunsigned long 4byte
32位编译器
char 1bytechar* 4byteshort int 2byteint 4byteunsigned int 4bytefloat 4bytedouble 8bytelong 4bytelong long 8byteunsigned long 4byte
64位编译器
char 1bytechar* 8byteshort int 2byteint 4byteunsigned int 4bytefloat 4bytedouble 8bytelong 8bytelong long 8byteunsigned long 8byte
char*
表示指针变量,它存的是变量的地址,所以在同一编译器下,不管是char*
还是int*
,它们所占位数都是相同的。 32
位的寻址空间是2^32
,即32
个bit
,也就是4
个byte
,所以32
位编译器中char*
(指针变量)占4byte
。同理64
位编译器占8byte
0 0
- 在C/C++中,int、char、double、long所占的字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double long unsigned int char 类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- jquery网页加载进度条NProgress.js
- 【C++】修改const变量的值
- 下面是释放Bitmap的示例代码片段:
- 新安装的mysql必须调整的10项配置
- 微信公众平台——AIRKISS技术
- 在C/C++中,int、char、double、long所占的字节数
- url编码
- SecureCRT连接思科交换机
- LeetCode(240)Search a 2D Matrix II
- django 1.8 官方文档翻译: 1-2-1 编写你的第一个Django应用,第1部分
- QtCreator委托类 QItemDelegate,自定义委托类
- python 分布式进程
- FZU 2197 最小花费
- HDU 1070 Milk(水~)