What will happen if I assign negative value to an unsigned char?
<p>In C++ primer it says that "if we assign an out of range value to an object of unsigned type the result is the remainder of the value modulo the number of values the target type can hold."</p>

<p>It gives the example: </p>

<pre><code>int main(){


unsigned char i = -1;
// As per the book the value of i is 255 .
}
</code></pre>

<p>Can anybody please explain it to me how this works.  </p>