How did we find value of x in the above case
Value of x = ~10 is -11 how?
hi @shrey_codes do you know about the 2s complement form?
Due to ~10 all the bits of 10 will be flipped including the MSB thus making the number negative and when you convert that number into decimal form it will come out to be -11
I have little doubt incase when is 2s compliment used and when 1s compliment used and how many bits to be taken into consideration
@shrey_codes 2s complement is used for storage of numbers. Number of bits depends from compiler to compiler, int usually has 32 bits, you can confirm with the help of sizeof(int)
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.