[Previous]
[Contents]
[Next]

max(), __max()

return the greater of two numbers

Synopsis:

#include <stdlib.h>

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

// C++
#define __max(a,b)  (((a) > (b)) ? (a) : (b))

Description:

The C max() and C++ __max() macros evaluate to be the greater of two values.

Returns:

The larger of the two values.

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

Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

Caveats:

max() and __max() are macros.

See also:

min()


[Previous]
[Contents]
[Next]