Define Bitwise-AND Operator: &:?
The bitwise-AND operator (&) compares every bit of its first operand to the corresponding bit of its second operand. If both bits are 1 the matching result bit is set to 1. or else the corresponding result bit is set to 0.
x
|
y
|
x & y
|
0
|
0
|
0
|
0
|
1
|
0
|
1
|
0
|
0
|
1
|
1
|
1
|
In the following instance the bitwise-AND operator (&) contrast the bits of two integers nNumA and nNumB:
// Example of the bitwise-AND operator
int nNumA=1, nNumB=3, nNumC; // 00000001, 00000011
nNumC = nNumA & nNumB; // nNumC is now 1