bitand operator

bitand operator Bitwise and operator

and-expr := and-expr & equality-expr | and-expr bitand equality-expr

The bitwise and operator requires integer or enumeration operands. It performs the usual arithmetic conversions, then does an and operation on pairs of bits in the operands, resulting in an integer.

The bitand keyword is interchangeable with the & token.


unsigned bitmask = 0xFFFF;

bitmask = bitmask & ~0x7E; // bitmask becomes 0xFF81

See Also

and, and_eq, bitor, compl, expression, xor, Chapter 3, <ciso646>