INT_MIN in C/C++
INT_MIN is a macro that specifies that an integer variable cannot store any value below this limit. It represents the minimum value or the lower limit of the integer data type.
The value of INT_MIN is:
- INT_MIN = –2147483648 (for 32-bit Integers)
- INT_MIN = –9,223,372,036,854,775,808 (for 64-bit Integers)
Note: Values of INT_MAX and INT_MIN may vary from compiler to compiler. Following are typical values in a compiler where integers are stored using 32 bits.
INT_MAX and INT_MIN in C/C++ and Applications
Most of the time, in competitive programming, there is a need to assign the variable, the maximum or minimum value that data type can hold, but remembering such a large and precise number comes out to be a difficult job. Therefore, C/C++ has certain macros to represent these numbers, so that these can be directly assigned to the variable without actually typing the whole number.
C/C++ provides two such macros namely INT_MAX and INT_MIN that represents the integer limits. Depending upon the compiler and C++ standard, you may be required to include the header file <limits.h> or <climits> in your C or C++ source code respectively. So it is advisable to include this header file for using the INT_MAX, and INT_MIN macros. For further reading on this header file, refer to this article.
Contact Us