Bitwise AND (&)

The bitwise AND operand takes both values of operands as integers. if any of the bits is 0, or both the bits are 0 then the ANDing gives a 0. If both

the bits are 1, the result of bitwise AND is a 1. eg. 1=10 and b=20 then their binary representation is:
a = 0000 0000 0000 1010
b = 0000 0000 0001 0100
then a & b= 0000 0000 0000 0000
The resulting value represent the number 0. The use of bitwise AND is to determine whether a particular bit is a 1 or a 0 in programming situations.

No comments:

Post a Comment