When an integer number is out of the type's range, the max value + 1 is added / subtracted (depends on which part of the range the number was). For example,
unsigned short num = 65537;
num will have a value of 1 (65536 was subtracted). My question is: why does it happen? My intuition tells me it has something to do with the carry flag and the overflow flag, because the maximum value is always 1111....
Thanks in advance!
warning: large integer implicitly truncated to unsigned type
– Rica