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

c++ 基本类型大小

2016-03-29 10:32 218 查看
#include  <iostream>
#include <windows.h>
using namespace std;

struct hehe{
char a;
int b;
char c;
};

//c++基本类型大小
int main()
{
cout << "整形:" << endl;
cout << sizeof(byte) << endl;  //1
cout << sizeof(short) << endl;  //2
cout << sizeof(int) << endl; //4
cout << sizeof(long) << endl; //4

cout << "浮点类型:" << endl;
cout << sizeof(float) << endl; //4
cout << sizeof(double) << endl;//8

cout << "布尔类型:" << endl;
cout << sizeof(boolean) << endl;//1
cout << "字符类型:" << endl;
cout << sizeof(char) << endl;//1

cout << "结构体:" << endl;
cout << sizeof(hehe) << endl;//12

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