How to initialize max variable

I have to make a program that stores the biggest sum you can get from a vector's integer elements. So how do I initialize max?

If it were about finding the minimum, I'd initialize min=MAXINT, or min=MAXLONG from #include<values.h> but it seems there is no MININT or MINLONG for me to initialize max. Can you help?
If you're using a modern C++ compiler and not Borland C, you could use the limits header.

http://www.cplusplus.com/reference/std/limits/numeric_limits/

1
2
3
#include <limits>

min = std::numeric_limits<int>::max();

Last edited on
Topic archived. No new replies allowed.