The bitwise OR operator (|) is a bitwise logical operator.
It is represent by vertical bar (^) symbol. It works with two operands I.e. it
is a binary operator. The comparison of bits started from the least significant
bit. It works with operands bit by bit.
The result of bitwise OR operator is 0 (zero) when both bits
has 0 (zero) values. The result of bitwise OR operator is 1 (one) when minimum
one bit has the value 1. If both bits have value 1 than result is also 1. The
operation table of bitwise OR (|)
operator is as follow:
Operand A
|
Operand B
|
Result ( A | B )
|
0
|
0
|
0
|
0
|
1
|
1
|
1
|
0
|
1
|
1
|
1
|
1
|
The precedence of bitwise OR operator is lower than the
relational operator so additional parentheses are necessary.
No comments:
Post a Comment