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

c++中各个数据类型的大小

2015-10-31 10:10 375 查看
来哦金额各种数据类型有助于我们对这门语言的更好掌握,更好的利用之来编程,下面是一个简单的获得数据类型的大小的程序,虽然简单,但实用性却很高。

#include <iostream>

using namespace std;

int main()
{
cout<<"confirm those dataType's size in ram"<<endl;
cout<<"int :"<<sizeof(int)<<endl;
cout<<"short int :"<<sizeof(short int)<<endl;
cout<<"long int :"<<sizeof(long int)<<endl;
cout<<"float :"<<sizeof(float)<<endl;
cout<<"double :"<<sizeof(double)<<endl;
cout<<"char :"<<sizeof(char)<<endl;
cout<<"the end!"<<endl;
return 0;
}


程序运行结果如下:

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