title: incorrect variable value after bit shift and addition in c
body: <p>I have this code which basically takes two integers and shifts each and adds them. However, after the addition I got an incorrect value. </p>
  
  <p>I have found a way out of this (that is by storing the shifted values in new unsigned int variables and adding the two) but I want to understand why this one did not work:</p>
  
  <pre><code>void change(uint8_t in[3], uint16_t out[2]){
      out[0] = in[0]&lt;&lt;2 + in[1]&gt;&gt;2;
      printf("%u\n",in[0]&lt;&lt;2 ); // outputs 48  --- correct
      printf("%u\n",in[1]&gt;&gt;2 ); // output 1 --- correct
      printf("%u\n",out[0] ); // output 768 --- wrong, I expected 49
  }
  
  int main(int argc, char const *argv[])
  {
      uint8_t in[3] = {12,6,9};
      uint16_t out[2];
      change(in,out);
      return 0;
  }
  </code></pre>