x64系统下:
#include <iostream>
using namespace std;
int main(){
cout<<"int size:"<<sizeof(int) << endl;
cout << "unsigned int size:" << sizeof(unsigned int) << endl;
cout << "long size:" << sizeof(long) << endl;
cout << "unsigned long size:" << sizeof(unsigned long) << endl;
cout << "char size:" << sizeof(char) << endl;
cout << "unsigned char size:" << sizeof(unsigned char) << endl;
cout << "long long size:" << sizeof(long long) << endl;
cout << "unsigned long long size:" << sizeof(unsigned long long) << endl;
cout << "short size:" << sizeof(short) << endl;
cout << "unsigned short size:" << sizeof(unsigned short) << endl;
cout << "float size:" << sizeof(float) << endl;
cout << "double size:" << sizeof(double) << endl;
cout << "long double size:" << sizeof(long double) << endl;
return 0;
}
结果如下: