Hey I would like to know what are the min and max macros....
Hey I would like to know what are the min and max macros....
min and max macro's compare two values and return either the smaller or larger value respectively. It compares numerical data types either signed or unsigned. The prototypes look like this.
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))
The macro's are defined in the windows header file.
"...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers
you can use a inline function it is easier like below code
#inline min(int a,int b){ a<b ? a : b ;}
and the max one is same
C++ Makes you Feel Better
"Gravity connot be held reponsible for people falling in love"--Albert Einstein