Logical operators act on the individual bits of ordinal expressions. Logical operators require operands that are of an integer type, and produce an integer type result. The possible logical operators are listed in table (12.4).
Operator | Operation |
not | Bitwise negation (unary) |
and | Bitwise and |
or | Bitwise or |
xor | Bitwise xor |
shl | Bitwise shift to the left |
shr | Bitwise shift to the right |
<< | Bitwise shift to the left (same as shl) |
>> | Bitwise shift to the right (same as shr) |
The following are valid logical expressions:
When performing logical operations, it should be noted that: