title: In C Left shift (char) 0xFF by 8 and cast it to int
body: <p>On left shift of (char) 0xff by 8 and casting it to int we get -256 or 0xffffff00.
  Can somebody explain why this should happen? </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main (void)
  {   
      char c = 0xff;
      printf("%d %x\n", (int)(c&lt;&lt;8),(int)(c&lt;&lt;8));
      return 0;
  }
  </code></pre>
  
  <p>Output is</p>
  
  <pre><code>-256 ffffff00
  </code></pre>