C语言 是否有 LARGEST_INTEGER 宏或类似的东西?(C)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3595984/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a LARGEST_INTEGER macro or something similar? (C)
提问by snakile
Possible Duplicates:
How would you set a variable to the largest number possible in C?
maximum value of int
I need to use the maximum integer value in my my code, but I don't want to explicitly write 4294967295. Is it defined somewhere?
我需要在我的代码中使用最大整数值,但我不想明确写出 4294967295。它是否在某处定义?
回答by James McNellis
INT_MAX(for int) or UINT_MAX(for unsigned int) defined in <limits.h>
INT_MAX(for int) 或UINT_MAX(for unsigned int) 定义于<limits.h>
回答by rano
There shall be a constant in limits.h, if I'm not mistaken it shall be INT_MAX
中应该有一个常量limits.h,如果我没记错的话应该是 INT_MAX
回答by alxx
#include <limits.h>
INT_MAX
回答by t0mm13b
INT_MAX as defined in <limits.h>
INT_MAX 定义在 <limits.h>
回答by Jens Gustedt
The include file stdint.hincludes all different macros for the different integer types. In particular UINTMAX_MAXfor uintmax_t.
包含文件stdint.h包括不同整数类型的所有不同宏。特别是UINTMAX_MAX对于uintmax_t.

