whenever a negative integer in stored in an unsigned modified variable-why the output is subtraction of that number with the highest number of that size?
Q5 of quiz on programming fundamentals
When you work with unsigned types, modular arithmetic (also known as “wrap around” behavior) is taking place.When a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type.
For eg.
(unsigned)0 - (unsigned)1 = -1 modulo UINT_MAX+1