title: Why subtract from 256 when assigning signed char to unsigned char in C++?
body: <p>in Bjarne's &quot;The C++ Programming Language&quot; book, the following piece of code on chars is given:</p>
  <pre><code>signed char sc = -140;
  unsigned char uc = sc;
  cout &lt;&lt; uc // prints 't'
  </code></pre>
  <p>1Q) chars are 1byte (8 bits) in my hardware. what is the binary representation of <code>-140</code>? is it possible to represent -140 using 8 bits. I would think range is guaranteed to be at least [-127...127] when signed chars is considered. how is it even possible to represent -140 in 8 bits?</p>
  <p>2Q) assume it's possible. why do we subtract <code>140</code> from <code>uc</code> when <code>sc</code> is assigned to <code>uc</code>? what is the logic behind this?</p>
  <p><strong>EDIT:</strong> I've wrote <code>cout &lt;&lt; sizeof (signed char)</code> and it's produced 1 (1 byte). I put this to be exact on the byte-wise size of <code>signed char</code>.</p>
  <p><strong>EDIT 2:</strong> <code>cout &lt;&lt; int {sc }</code> gives the output <code>116</code>. I don't understand what happens here?</p>