MAX - Online Linux Manual PageSection : 3
Updated : 2022-10-30
Source : Linux man-pages 6.03

NAMEMAX, MIN − maximum or minimum of two values

LIBRARYStandard C library (libc, −lc)

SYNOPSIS#include <sys/param.h>MAX(a, b); MIN(a, b);

DESCRIPTIONThese macros return the maximum or minimum of a and b.

RETURN VALUEThese macros return the value of one of their arguments, possibly converted to a different type (see BUGS).

ERRORSThese macros may raise the "invalid" floating-point exception when any of the arguments is NaN.

STANDARDSThese nonstandard macros are present in glibc and the BSDs.

NOTESIf either of the arguments is of a floating-point type, you might prefer to use fmax(3) or fmin(3), which can handle NaN. The arguments may be evaluated more than once, or not at all. Some UNIX systems might provide these macros in a different header, or not at all.

BUGSDue to the usual arithmetic conversions, the result of these macros may be very different from either of the arguments. To avoid this, ensure that both arguments have the same type.

EXAMPLES #include <stdio.h> #include <stdlib.h> #include <sys/param.h> int main(int argc, char *argv[]) { int a, b, x; if (argc != 3) { fprintf(stderr, "Usage: %s <num> <num>\n", argv[0]); exit(EXIT_FAILURE); } a = atoi(argv[1]); b = atoi(argv[2]); x = MAX(a, b); printf("MAX(%d, %d) is %d\n", a, b, x); exit(EXIT_SUCCESS); }

SEE ALSOfmax(3), fmin(3)
0
Johanes Gumabo
Data Size   :   7,040 byte
man-MIN.3Build   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 170,765
Visitor ID   :     :  
Visitor IP   :   18.191.44.145   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.