previous | start | next

Bitwise and



unsigned char x = 0x1C;
unsigned char y = 0x95;
In binary x's value:  00011101
          y's value:  10010101
          ---------- ---------
          x & y    :  00010101

In hex x's value: 0x1C
       y's value: 0x95
       ---------  --
       x & y      0x15

(In decimal, x & y = 21.)

The & operation is performed on each bit position k of its operands to
produce the bit value in the k-th position of the result. The result
bit is determined by the table

               right bit
               0   1
              ------
   left bit 0| 0   0
            1| 0   1



previous | start | next