max
raw OCR
Returns the larger of two values.
Defined in header <stdlib.h>
Syntax
#include <stdlib.h>
(type) max(fl, h);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ |
Remarks
This macro compares two values and returns the larger of the two. Both arguments and the macro declaration must be of the same type.
Return value
max returns the larger of two values.
See also
Example
#include <stdlib.h>
iinclude <stdio.h>
int main(void)
int X = 5, y = 6, z;
z = max (X, y);
printfC'The larger number is %d\n", z);
return 0;
Program output
The larger number is
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/stdlib.h/max/
· short form /3.1/max/