__max

Description

Returns the larger of two values.

#include <stdlib.h>

type __max( type a, type b );

type Any numeric data type  
a, b Values of any numeric type to be compared  

Remarks

The __max macro compares two values and returns the value of the larger one. The arguments can be of any numeric data type, signed or unsigned. Both arguments and the return value must be of the same data type.

Return Value

The macro returns the larger of the two arguments.

Compatibility

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:DOS32X

See Also

__min

Example

/* MINMAX.C */

#include <stdlib.h>

#include <stdio.h>

void main( void )

{

int a = 10;

int b = 21;

printf( "The larger of %d and %d is %d\n", a, b, __max( a, b ) );

printf( "The smaller of %d and %d is %d\n", a, b, __min( a, b ) );

}

Output

The larger of 10 and 21 is 21

The smaller of 10 and 21 is 10