Set the most significant bit of an int

This tip submitted by Alphonse Ajayan on 2011-12-23 00:20:17. It has been viewed 21969 times.
Rating of 5.4 with 161 votes



int main()
{
int x = 1<<((sizeof(int)*8)-1);
printf("%d",x);
return 0;
}



More tips

Help your fellow programmers! Add a tip!