min (C++)
Remonter à stdlib.h - Index
Header File
stdlib.h
Category
C++ Prototyped Routines
Prototype
(type) min(a, b); /* macro version */
template <class T> T min( T t1, T t2 );// C++ only
Description
Returns the smaller of two values.
The C macro and the C++ template function compare two values and return the smaller of the two. Both arguments and the routine declaration must be of the same type.
Return Value
min returns the smaller of two values.
Example
#include <stdlib.h> #include <stdio.h> #ifdef __cplusplus int max (int value1, int value2); int max(int value1, int value2) { return ( (value1 > value2) ? value1 : value2); } #endif int main(void) { int x = 5; int y = 6; int z; z = max(x, y); printf("The larger number is %d\n", z); return 0; }