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