Maximum and Minimum values for ints
In most modern programming languages, the maximum value for an int
data type is implementation-specific, but is typically in the range of 2^31 - 1 to 2^63 - 1, and the minimum value is usually -2^31 or -2^63. In C and C++, the INT_MAX
and INT_MIN
macros are defined in the <limits.h>
header file, and can be used to determine the maximum and minimum values for the int
data type on a particular platform.
For example, in 32-bit system, it is 2147483647 and -2147483648 and on 64-bit it will be 9223372036854775807 and -9223372036854775808 respectively.