共用方式為


__min

傳回兩個較小的值。

type __min(
   type a, 
   type b 
);

參數

  • type
    任何數字資料型別。

  • a, b
    欲比較的兩個數值型別資料。

傳回值

較小的兩個引數。

備註

__min 巨集比較兩個數值並回傳較小者的數值。 參數可以是任何數值型別資料,有號或無號。 兩個引數和回傳值都必須是相同的資料型別。

需求

常式

必要的標頭

__min

<stdlib.h>

範例

// 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 ) );
}
  

.NET Framework 對等用法

System::Math::Min

請參閱

參考

浮點支援

__max