int max_value = std::max({a, b, c});
It makes use of an overload of std::max which takes std::initializer_list<T>
It also means that we can pass more than three argument.
int max_value = std::max({1,2,3,4,5,6,98,10});
Filed under: C
Like this post? Subscribe to my RSS feed and get loads more!




Leave a Reply