C++数据类型
//短整型 2字节
short i =10;
//整型 4字节
int i1=11;
//长整型 4 字节或8字节
long i2=2;
//长长整型 8字节
long long i3 =4;
//单精度
float i4 = 4.14f;
//双精度
double i5 = 5.5;
//字符型
char c= 'a';
// c风格字符串
char str[] = "hello world";
// C++ 风格字符串 #include <string>
string str2 ="hello world";
// 布尔类型
bool b=true;
// sizeof 函数判断数据类型所占的字节数
std:: cout << "i3:" << sizeof(i3) << "\n";
std:: cout << sizeof(long) << "\n";
浙公网安备 33010602011771号