min

return the lesser of two numbers

Synopsis:

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

Description:

The min() macro is evaluated to be the lesser of two values. It is implemented as follows:

#define min(a,b)  (((a) < (b)) ? (a) : (b))

Returns:

the smaller of the two values passed.

See also:

max()

Examples:

#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

Classification:

WATCOM

Systems:

All (except DOS/PM)