C++ Min
C Algorithm min C Algorithm min function can be used in following 3 ways: It compares the two values passed in its arguments and returns the smaller between them, and if both are equal, then it returns the first one.
-->A preprocessor macro that returns the smaller of two values.
- 7 hours agoLast updated 7 hours ago Updated 7 days a week Tonight will be dry with clear skies throughout. It will feel slightly less chilly than last night. Tomorrow will be another dry day with.
- 12 hours agoLast updated 12 hours ago Updated 7 days a week A sunny day today, but some patchy cloud will make the sunshine hazy in places. Mild too with a gentle breeze. Plenty of late sunshine.
Syntax
Parameters
a, b
Values of any type that the < operator works on.
Return Value
The smaller of the two arguments.
Remarks
The __min macro compares two values and returns the value of the smaller 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. This can lead to unexpected results if the argument is an expression that alters its value when it is evaluated, such as *p++
.
Requirements
Routine | Required header |
---|---|
__min | <stdlib.h> |
Example
C++ Min Function
See also
C++ Mingfx
Floating-Point Support
__max