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."
It gives the example:
int main(){
unsigned char i = -1;
// The value of i is 255
}
Can anybody please explain it to me how this works.
Aucun commentaire:
Enregistrer un commentaire