Jake Ramos Jake Ramos - 20 days ago 6
C++ Question

(C++) INT_MAX and INT_MIN could not be resolved?

I am currently taking a C++ course on www.udemy.com In one of the lessons the teacher is using

#include <limits>
to demonstrate the maximum number of integers an integer can have. However, when I go to include limits, everything goes well until I try to print INT_MAX and INT_MIN to see the maximum integers and the minimum integers.
Here is my code:

#include <iostream>
#include <limits>

using namespace std;

int main() {

cout << "MaxInt= " << INT_MAX << endl;
cout << "MinInt = " << INT_MIN << endl;
return 0;
}


Side note: I am using Eclipse Neon CDT on Windows 10 with the MinGW Compiler.

Answer

You want #include <climits> or <limits.h>, not <limits>.