return the greater of two numbers
#include <stdlib.h> // C #define max(a,b) (((a) > (b)) ? (a) : (b)) // C++ #define __max(a,b) (((a) > (b)) ? (a) : (b))
The C max() and C++ __max() macros evaluate to be the greater of two values.
The larger of the two values.
#include <stdio.h>
#include <stdlib.h>
void main()
{
int a;
/*
* The following line will set the variable "a"
* to 10, since 10 is greater than 1.
*/
a = max( 1, 10 );
printf( "The value is: %d\n", a );
}
WATCOM
| Safety: | |
|---|---|
| Interrupt handler | Yes |
| Signal handler | Yes |
| Thread | Yes |
max() and __max() are macros.