+ 1

Why is it that (-1 == ~!-1) is true?

How can (-1 == ~!-1) be true? I understand that !-1 equals 0, but what else is going on here?

3rd Apr 2018, 7:59 PM
Bebida Roja
Bebida Roja - avatar
1 Answer
+ 5
!-1 is false or 0. ~0 flips all the zero bits to one or -1.
3rd Apr 2018, 8:26 PM
John Wells
John Wells - avatar