I am following this tutorial: https://www.tutorialspoint.com/cprogramming/c_bitwise_operators.htm https://www.tutorialspoint.com/cprogramming/c_operators.htm
I am confused how A which starts out as: A = 0011 1100 (60 in decimal) can become -61 when all the bits are flipped with the ~ operator.
I understand that ~A
will become: 1100 0011. From my calculations, this binary number 1100 0011 equals 195 in decimal. However the answer is -61 in base ten according to the c programming language and the tutorial.
Could someone please help me understand?
Thank-you for reading this question.