title: C++ char arithmetic overflow
body: <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      char a = 30;
      char b = 40;
      char c = 10;
      printf ("%d ", char(a*b));
      char d = (a * b) / c;
      printf ("%d ", d);
      return 0;
  }
  </code></pre>
  
  <p>The above code yields normal int value if <code>127 &gt; x &gt; -127</code>
  and a overflow value if other. I can't understand how the overflow value is calculated. As -80 in this case.
  Thanks</p>