|
Description
The bitwise OR operator in C++ is the vertical bar symbol, |. Like the & operator, | operates independently each bit in its two surrounding integer expressions, but what it does is different (of course). The bitwise OR of two bits is 1 if either or both of the input bits is 1, otherwise it is 0.
In other words:
Example Code
One of the most common uses of the Bitwise OR is to set multiple bits in a bit-packed number.
See Also
- Language : << (bitshift left)
- Language : >> (bitshift right)
- Language : & (bitwise and)
- Language : ~ (bitwise not)
- Language : ^ (bitwise xor)
- Language : || Logical OR
- Example : BitMath Tutorial
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |
Additionally, some links direct to products from our own brand, DIYables.