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.

Similar Reads

INT_MAX in C/C++

INT_MAX is a macro that specifies that an integer variable cannot store any value beyond this limit. It represents the maximum value of the upper limit of the integer data type in C/C++....

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....

Example of INT_MIN and INT_MAX

C++ // C++ program to print values of INT_MAX // and INT_MIN #include #include using namespace std; int main() { cout << INT_MAX << endl; cout << INT_MIN; return 0; } C // C program to print values of INT_MAX // and INT_MIN // we have to include limits.h for results in C #include #include int main() { printf("%d\n", INT_MAX); printf("%d", INT_MIN); }...

Applications of INT_MAX and INT_MIN

Following are the major applications of INT_MAX and INT_MIN...

FAQs on INT_MIN and INT_MAX

1. Why abs(INT_MIN) does not give the expected result?...

Contact Us