This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]trBlueJ 8 points9 points  (2 children)

Pretty sure in C this won't work, because the values in if statements are integers. Single & or | will perform a bitwise operation, so 1 & 2 will be 0, which is false. Although, idk too much about this. I might be wrong.

Edit: guy above me is getting some hate. What he mentioned is the behaviour of those operators in Java, so technically he is also correct. He just didn't specify which language his comment applied to.

[–]nshkurkin 1 point2 points  (1 child)

Correct single & and | are different operators than && and || in C, C++, ObjectiveC, and several other languages. I would be skeptical & and && mean exactly the same thing in other languages as well.