Cpp data modifier

i attempted a quiz there is a question which is posted as


in this why unsigned int take so large value in output
for example in line 6,7

@Iitianrahman
It is an unsigned int variable which means it cannot take a negative value. It can only store positive integers ( and zero ) in it.
We try to assign the negative value -2019 to the variable BOSS2 . This is outside the range of unsigned int variable and is considered as an underflow condition.
The value is modified from -2019 to 2^32 - 2019 which is equal to 4294965277 . Hence the large answer.

Similar case for BOSS1.
Since it is a short unsigned int , its range is smaller and is converted as
-2018 -> 2^16 - 2018 = 63518

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.