两种方法求Int最值

#include < stdio.h >

int main()
{
unsigned
int temp;
int Max,Min;

Min
= 0x7fffffff + 1 ;
Max
= 0x7fffffff ;
printf(
" IntMax is %d\n " ,Max);
printf(
" IntMin is %d\n " ,Min);

temp
= (unsigned int ) - 1 ;
Max
= temp >> 1 ;
Min
=~ (temp >> 1 );
printf(
" IntMax is %d\n " ,Max);
printf(
" IntMin is %d\n " ,Min);
return 0 ;
}

 

你可能感兴趣的:(int)