In the C++ standard library header
, you will find:
std::numeric_limits::max()
Which will tell you the maximum value that can be stored in a variable of type int
. numeric_limits
is a class template, and you can pass it any of the numeric types to get the maximum value that they can hold.
The numeric_limits
class template has a lot of other information about numeric types as well.