max

return the greater of two numbers

Synopsis:

#include <stdlib.h>
#define max(a,b)  (((a) > (b)) ? (a) : (b))

Description:

The max() macro will evaluate to be the greater of two values. It is implemented as follows:

#define max(a,b)  (((a) > (b)) ? (a) : (b))

Returns:

The max() macro will evaluate to the larger of the two values passed.

See also:

min()

Examples:

#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 );
  }

Classification:

WATCOM

Systems:

All (except DOS/PM)