可能重复:
How would you set a variable to the largest number possible in C?
maximum value of int是否有LARGEST_INTEGER宏或类似的东西? (C)
我需要在我的我的代码使用的最大整数值,但我不想明确写入4294967295。它是在什么地方定义的?
可能重复:
How would you set a variable to the largest number possible in C?
maximum value of int是否有LARGEST_INTEGER宏或类似的东西? (C)
我需要在我的我的代码使用的最大整数值,但我不想明确写入4294967295。它是在什么地方定义的?
INT_MAX
(为int
)或UINT_MAX
(对于unsigned int
)在<limits.h>
使用limits.h
定义:
#include <limits.h>
int maximum = INT_MAX;
INT_MAX如<limits.h>
#include <limits.h>
INT_MAX
定义须有在恒定limits.h
,如果我没有弄错,它应该是INT _MAX
包含文件stdint.h
包括用于所述不同的整数类型的所有不同的宏。特别是UINTMAX_MAX
的uintmax_t
。