description | title | ms.date | api_name | api_location | api_type | topic_type | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: __max |
__max |
04/05/2018 |
|
|
|
|
|
|
05c936f6-0e22-45d6-a58d-4bc102e9dae2 |
A preprocessor macro that returns the larger of two values.
#define __max(a,b) (((a) > (b)) ? (a) : (b))
a
, b
Values of any numeric type to be compared.
__max
returns the larger of its arguments.
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.
The argument returned is evaluated twice by the macro. Double evaluation can lead to unexpected results if the argument is an expression that alters its value when it's evaluated, such as *p++
.
Macro | Required header |
---|---|
__max |
<stdlib.h> |
For more information, see the example for __min
.