min(3C)
_________________________________________________________________
min $builtin function
Return the minimum value of two integers.
_________________________________________________________________
Calling Sequence
int a, b, c, min();
a = min(b, c);
(or)
$builtin int min();
int a, b, c;
a = min(b, c);
Description
Return the integer minimum of two numbers with the min function.
The first version uses a function call. The second might
generate smaller or faster code. The include file math.h defines
this entry and uses the $builtin version.
Returns
The min function returns the integer minimum of the two numbers
you pass.
Related Functions
See also the max and fmin functions.
Example
/* Program test for the min() function */
#include <math.h>
int i = 1, a, b, c, min();
main(argc, argv)
int argc;
char *argv[];
{
while (i+1 < argc) {
a = atoi(argv[i]);
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
min(3C)
b = atoi(argv[i+1]);
printf("Minimum of %d and %d is %d.\n",
a, b, c = min(a, b));
i++;
}
}
A call to the program test with the numbers 64, 16, 32, and 8
generates the output
Minimum of 64 and 16 is 16.
Minimum of 16 and 32 is 16.
Minimum of 32 and 8 is 8.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)