title: C AVR Serial: Strange behaviour while using integers of different sizes
body: <p>I am trying to get the remainder when two integers are divided.And also trying to get the quotient.My variables are follows:</p>
  
  <pre><code>    const uint16_t key = 1000;
      uint8_t remainder;
      uint16_t temp;
       temp = somefunction();  //This returns a uint32_t
  
       while((UCSR0A&amp;(1&lt;&lt;RXC0)) == 0);  //WAIT FOR CHAR
       //Wait for a char from serial
       remainder = temp % key;
       quotient = (temp/key);
  
        //Now I check to see if I got the correct remainder
        while((UCSR0A&amp;(1&lt;&lt;UDRE0)) == 0); //wait until empty 
        UDR0 = remainder;
        //The remainder I get in minicom is something I am not expecting.
        //I checked the result of somefunction() and it is correct
  </code></pre>
  
  <p>Please help!</p>