c++整型数据

short int:  2Byte , 范围 -2^15 --- 2^15 - 1。无符号范围为:0 --- 2^16 - 1

int:   4Byte,范围 -2^31 --- 2^31 - 1。无符号范围为:0 --- 2^32- 1

long int: 平台的表现不一致,windows 平台 4Byte,linux平台 32bit系统 4Byte, 64bit系统8Byte。在编程时,需要考虑跨平台,避免使用long 类型,可以按照需求,使用int 型或long long int 来替代。

long long int:8Byte

编程时,需要按需选取对应的整型数据,并且注意数据类型的大小,超过范围可能会溢出。

你可能感兴趣的:(c++整型数据)