int ,long , long long类型的范围
类型 | 最小值 | |
unsigned int | 0 | 4294967295 |
int | -2147483648 | |
unsigned long | 0 | 4294967295 |
long | -2147483648 | |
Unsigned long long | 0 | 18446744073709551615 (2^64 - 1) |
long long | -9223372036854775808 | 9223372036854775807 |
unsigned __int64 | 0 | 18446744073709551615 (2^64 - 1) |
__int64 | -9223372036854775808 | 9223372036854775807 |
long long是64bit存储的,而int只有32bit
赋初始值的时候,虽然直接写long long i=10000000000也可以
但程序处理的时候会先将10000000000变为int再赋值
一般long long初值是大数的话,是需要写成long long i=10000000000LL