Bitwise Or in C and C++

integral-value | integral-value;
| is a bitwise operator; it operates on each individual bit of its two arguments, performing an or operation. For each bit position in the two values, if either of the bits in its two arguments is set to 1, then the result has a bit of 1 in that bit position. Otherwise, if both bits are 0, it has a value of 0.

For example, if you have binary 0010 and 0110, then bitwise or of the two values returns 0110.


Bitwise operators tutorial

Learn more about bitwise operators and techniques