Set the most significant bit of an intThis tip submitted by Alphonse Ajayan on 2011-12-23 00:20:17. It has been viewed 10176 times.
Rating of 8.5 with 57 votes
int x = 1<<((sizeof(int)*8)-1);
Help your fellow programmers! Add a tip!
Want to become a C++ programmer? The Cprogramming.com ebook, Jumping into C++, will walk you through it, step-by-step. Get Jumping into C++ today!