return the lesser of two numbers
#include <stdlib.h> #define min(a,b) (((a) < (b)) ? (a) : (b))
The min() macro is evaluated to be the lesser of two values. It is implemented as follows:
#define min(a,b) (((a) < (b)) ? (a) : (b))
the smaller of the two values passed.
#include <stdio.h>
#include <stdlib.h>
void main()
{
int a;
/*
* The following line will set the variable "a"
* to 1, since 10 is greater than 1.
*/
a = min( 1, 10 );
printf( "The value is: %d\n", a );
}
produces the output:
1
WATCOM
All (except DOS/PM)