Min/Max

In C++ do the statements minimum and maximum work as they look? Sorry I'm unsure of the proper terminology. But can I essentially use min to find the smallest of 3 numbers? And the same for max? IE
1
2
3
4
int min(int a, int b, int c)
{ 
   return min(min(a,b)c);
}
You missed a comma.

return min (min (a,b) , c);
You can also use
1
2
3
4
int min(int a, int b, int c)
{ 
   return min({a,b,c});
}


I guess the name of your function is also the same as one in the std:: namespace.
Last edited on
Topic archived. No new replies allowed.