Skip to main content

Posts

Showing posts with the label bitwise OR

What Is The Difference Between 'bit-wise AND' and 'conditional AND' ?

The & and || operators are defined for two integer operands or two boolean operands. The && and || operators are not defined for anything but two boolean operands. For all other operand types and combinations, a compile-time error shall occur. The Integer Type Operands The & operator is the "bit-wise AND" operator and | is the "bit-wise OR" operator.  This permits you to manipulate individual bits in a number. The Boolean Type Operands The && is the "conditional AND" operator and  || is the "conditional OR" operator. The && and || operators are evaluated in short circuit fashion. This means that when you have an expression like:   e1 && e2