# include <iostream>
using namespace std;
int main()
{
cout << "========== BASIC VARIABLES SIZE LIST ==========" << endl;
cout << "short: " << sizeof(short) << " bytes" << endl;
cout << "int: " << sizeof(int) << " bytes" << endl;
cout << "long: " << sizeof(long) << " bytes" << endl;
cout << "long long: " << sizeof(long long) << " bytes" << endl;
cout << "boolean: " << sizeof(bool) << " byte" << endl;
cout << "float: " << sizeof(float) << " bytes" << endl;
cout << "long float: " << sizeof(long float) << " bytes" << endl;
cout << "double: " << sizeof(double) << " bytes" << endl;
cout << "long double: " << sizeof(long double) << " bytes" << endl;
cout << "char: " << sizeof(char) << " byte" << endl;
cin.get();
}
========== BASIC VARIABLES SIZE LIST ==========
short: 2 bytes
int: 4 bytes
long: 4 bytes
long long: 8 bytes
boolean: 1 byte
float: 4 bytes
long float: 8 bytes
double: 8 bytes
long double: 8 bytes
char: 1 byte
标签:变量,int,float,bytes,long,C++,大小,byte
From: https://www.cnblogs.com/cloucodeforfun/p/17351043.html