#include <stdio.h>
#include <stdint.h>
uint8_t fun( uint8_t a , uint8_t b , uint8_t c )
{
if(a <= b)
{
if(a <= c)
{
return (b <= c) ? b : c;
}
else
return a;
}
else if( b <= c)
{
return (a <= c) ? a : c;
}
else
{
return b;
}
}
int main()
{
uint8_t a,b,c,mid;
a = 11;
b = 20;
c = 19;
mid = fun( a , b , c );
printf("mid = %d\n",mid);
return 0;
}
结果:mid = a、b、c中间的数
mid = 19