C Int 和 Long 32 - 64 位中的值范围 [英] Range of values in C Int and Long 32 - 64 bits
问题描述
我对 C 中 Int 变量的值范围感到困惑.
I'm confused with range of values of Int variable in C.
我知道 32 位 unsigned int 的范围是:0 到 65,535.那么长有 0 到 4,294,967,295
I know that a 32bits unsigned int have a range of: 0 to 65,535. So long has 0 to 4,294,967,295
这在 32 位机器上很好.但是现在在 64 位机器中所有的东西都保持不变?或者我的int容量不一样?
This is fine in 32bits machine. But now in 64bits machines all thing keep the same? Or maybe my int capacity is different?
作为新手,我理解这些问题,但我真的很困惑.此方法签名也无济于事.:)
I understand this questions as newbie, but I'm really confused. This method signature is not helping too. :)
unsigned long long int atomicAdd(unsigned long long int* address, unsigned long long int val);
推荐答案
在 C 和 C++ 中,您有这些最少的要求(即实际实现可以有更大的量级)
In C and C++ you have these least requirements (i.e actual implementations can have larger magnitudes)
signed char: -2^07+1 to +2^07-1
short: -2^15+1 to +2^15-1
int: -2^15+1 to +2^15-1
long: -2^31+1 to +2^31-1
long long: -2^63+1 to +2^63-1
现在,在特定实现中,您有多种位范围.维基百科文章很好地描述了这一点.
Now, on particular implementations, you have a variety of bit ranges. The wikipedia article describes this nicely.
这篇关于C Int 和 Long 32 - 64 位中的值范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!