title: How to determine size limits of variable?
body: <p>I'm struggling with determining edge-sizes of each variable. I can't understand the following problem.</p>
  
  <p>To get maximum value of char for example, I use: <code>~ 0 &gt;&gt; 1</code>
  Which should work like this: </p>
  
  <ol>
  <li>transfer 0 to binary: 0000 0000 (I assume that char is stored on 8
  bits) </li>
  <li>negate it: 1111 1111 (now I'm out of char max size) </li>
  <li>move one place right: 0111 1111 (I get 127 which seems to be correct)</li>
  </ol>
  
  <p>Now I want to present this result using <code>printf</code> function.
  Why exactly do I have to use cast like this:
   <code>printf("%d\n", (unsigned char)(~0) &gt;&gt; 1)</code>?</p>
  
  <p>I just don't get it. I assume that it has something to do with point 2 when I get out of char range, but I'm not sure.</p>
  
  <p>I will be grateful if you present me more complex explanation to this problem.</p>