没有sort没有比较操作符:

   
  #define CHAR_BIT_NUM 8
  
int min(int a, int b)
{
return b+((a-b)&((a-b)>>(sizeof(int)*CHAR_BIT_NUM-1)));
}

int smallest(int a, int b, int c)
{
return min(a, min(b, c));
}

达菲鸡王子 answered 12 years, 8 months ago

Your Answer