Bitwise OR in C – Why 4 | 2 Is 6 but 4 | 4 Is 4
Bitwise OR merges two bit patterns: a result bit is 1 if either operand has it. This question from our C Programming Quiz App uses two numbers whose bits don’t overlap — which makes OR behave exactly like addition, and that’s precisely what makes it a good test of whether you’re thinking in bits. The …