if int a = 8;
so when we do a = ~a;
then cout<<a; should gives us 7, right?
as 8 in binary is 1 0 0 0 and after flipping all the digits it becomes 0 1 1 1 which is 7.
But the output i am getting is -9 and not 7. Why is it so?
Doubt in NOT operator
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.