Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The number 200 is out of the value range for <code>signed char</code>. It wraps around into the negative value range in a two's complement way.</p> <p>Obviously the (implicit) signedness of <code>char</code> is defined to be <code>signed</code> on your platform. Note that this is not mandated by the standard. If it were <code>unsigned</code>, your program would print 200. For further reading on this topic:</p> <ul> <li><a href="https://stackoverflow.com/q/1211982/1025391">Can someone explain how the signedness of char is platform specific?</a></li> </ul> <p>Obviously, the size of the <code>char</code> type is 8 bits on your platform. The definition of this quantity is unspecified by the language specification as well. If it were larger, the program may very well print 200, just as you expected. For further reading on this topic:</p> <ul> <li><a href="https://stackoverflow.com/q/881894/1025391">Is char guaranteed to be exactly 8-bit long?</a></li> </ul> <p>Also note, that it is not specified by the standard that integer types must use the two's complement binary representation. On a different platform, the cast may even produce a completely different result. For further reading:</p> <ul> <li><a href="http://en.wikipedia.org/wiki/Signed_number_representations" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Signed_number_representations</a></li> <li><a href="http://en.wikipedia.org/wiki/Signed_number_representations#Comparison_table" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Signed_number_representations#Comparison_table</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload