title: Why does it make a difference if left and right shift are used together in one expression or not?
body: <p>I have the following code:</p>
  
  <pre class="lang-c prettyprint-override"><code>unsigned char x = 255;
  printf("%x\n", x); // ff
  
  unsigned char tmp = x &lt;&lt; 7;
  unsigned char y = tmp &gt;&gt; 7;
  printf("%x\n", y); // 1
  
  unsigned char z = (x &lt;&lt; 7) &gt;&gt; 7;
  printf("%x\n", z); // ff
  </code></pre>
  
  <p>I would have expected <code>y</code> and <code>z</code> to be the same. But they differ depending on whether a intermediary variable is used. It would be interesting to know why this is the case.</p>