Skip to content

Latest commit

 

History

History
112 lines (97 loc) · 2.06 KB

File metadata and controls

112 lines (97 loc) · 2.06 KB
title __min | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-standard-libraries
ms.tgt_pltfrm
ms.topic article
apiname
__min
apilocation
msvcrt.dll
msvcr80.dll
msvcr90.dll
msvcr100.dll
msvcr100_clr0400.dll
msvcr110.dll
msvcr110_clr0400.dll
msvcr120.dll
msvcr120_clr0400.dll
ucrtbase.dll
apitype DLLExport
f1_keywords
__min
min
_min
dev_langs
C++
helpviewer_keywords
__min macro
min macro
minimum macro
_min macro
ms.assetid 2037f26c-b48a-4a69-8870-22519f052a3c
caps.latest.revision 14
author corob-msft
ms.author corob
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

__min

Returns the smaller of two values.

Syntax

type __min(  
   type a,  
   type b   
);  

Parameters

type
Any numeric data type.

a, b
Values of any numeric type to be compared.

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.

Requirements

Routine Required header
__min <stdlib.h>

Example

// crt_minmax.c  
  
#include <stdlib.h>  
#include <stdio.h>  
  
int main( void )  
{  
   int a = 10;  
   int b = 21;  
  
   printf( "The larger of %d and %d is %d\n",  a, b, __max( a, b ) );  
   printf( "The smaller of %d and %d is %d\n", a, b, __min( a, b ) );  
}  
The larger of 10 and 21 is 21  
The smaller of 10 and 21 is 10  

See Also

Floating-Point Support
__max