#include <iostream>
//#include <climits> //#include <limits.h>
int main()
{
using namespace std;
int n_int = INT_MAX;
short n_short = SHRT_MAX;
long n_long = LONG_MAX;
long long n_llong = LLONG_MAX;
cout << "int is" << " "<< sizeof(int) << "bytes." << endl;
cout << "int is" << " "<< sizeof(n_int) << "bytes." << endl;
cout << "short is" << " "<< sizeof(short) << "bytes." << endl;
cout << "long is" << " "<< sizeof(long) << "bytes." << endl;
cout << "long long is" <<" "<< sizeof(long long) << "bytes." << endl;
cout << "Bits per byte is" << " " << CHAR_BIT << endl;
cout << endl;
cout << "INT_MAX=" << n_int << endl;
cout << "SHRT_MAX=" << n_short << endl;
cout << "LONG_MAX=" << n_long << endl;
cout << "LLONG_MAX=" << n_llong << endl;
cout << "INT_MIN=" << INT_MIN << endl;
cout << endl;
return 0;
}
以上输出来自运行64位Windows 10的系统。