Hello People,
I cannot understand how this expression gets evaluated ..


From what I know ~ has higher priority . So the expression becomes
1+(~0)= 2

But the answer that I got was 0. I know it is some thing to do with the fact that ~ is right associative but I cannot put my finger on it

Recommended Answers

~0 is "all bits set", not 1. !0 is 1.

Jump to Post

All 2 Replies

~0 is "all bits set", not 1. !0 is 1.

Damm.... I feel like such an ass .....:@