long long和long int之间有什么区别

Sye*_*sma 12 c c++ linux type-conversion

我知道long和int之间的区别但是"long long"和"long int"之间有什么区别

And*_*ron 24

内置类型有几个简写.

  • short是(signed)short int
  • long是(signed)long int
  • long long是(signed)long long int.

在许多系统上,short是16位,long是32位,long long是64位.但是,请记住标准只需要

sizeof(char) == 1
sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long)
Run Code Online (Sandbox Code Playgroud)

这样做的结果是,在异国情调的系统上,sizeof(long long) == 1是可能的.


Nic*_*tti 10

根据C标准,定义整数类型以提供至少以下范围:

int                     -32767 to               +32767 representable in 16 bits
long               -2147483647 to          +2147483647 representable in 32 bits
long long -9223372036854775807 to +9223372036854775807 representable in 64 bits
Run Code Online (Sandbox Code Playgroud)

每个都可以表示为支持更广泛的范围.上常见的32个系统intlong具有相同的32位表示.

注意,负边界与它们的正对应物是对称的,以允许符号和幅度表示:C语言标准强加两个补码.