首页 > 其他 > 详细

数据类型所占用内存的大小

时间:2017-05-12 10:11:42      阅读:285      评论:0      收藏:0      [点我收藏+]

数据类型所占的大小是由编译器和你电脑的架构共同决定的。

举个例子: 定义一个int x=0;

那么怎么去查看到底这个int型的x变量占用的内存大小呢。

c++中提供了sizeof这个函数。

我们可以打印sizeof(x)去验证,我的电脑上是占用4个bytes。

 

You may be surprised to find that the size of a given data type is dependent on the compiler and/or the computer architectureint!

数据类型所占用内存的大小

原文:http://www.cnblogs.com/qqtuywer/p/6844183.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!