return the lesser of two numbers
#include <stdlib.h> // C #define min(a,b) (((a) < (b)) ? (a) : (b)) // C++ #define __min(a,b) (((a) < (b)) ? (a) : (b))
The C min() and C++ __min() macros evaluate to be the lesser of two values.
The smaller of the two values.
#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
| Safety: | |
|---|---|
| Interrupt handler | Yes |
| Signal handler | Yes |
| Thread | Yes |
min() and __min() are macros.