#include <iostream> using namespace std; int main() { //整型shaort(2),int(4),long(4),long long(8) //可以利用sizeof求出数据类型占用的内存大小; //语法:sizeof(数据类型或变量) short num = 10; cout << "short占用的内存空间" << sizeof(num) << endl; cout << "int占用的内存空间" << sizeof(int) << endl; cout << "long占用的内存空间" << sizeof(long) << endl; cout << "long long占用的内存空间" << sizeof(long long) << endl; //整型比较 //short<int<=long<=long long system("pause"); return 0; }