Search code examples
cbinaryoperatorsbit

Evaluating 8-bit binary values with the & operator


I am having trouble evaluating 8-bit unsigned binary values with the & operator.

For example: would 0b11110101 & 0b11111100 = 0b01001010.

If not, then what would be the correct binary value?


Solution

  • (a) 0b11110101 &
    (b) 0b11111100 =
    ----------------
        0b11110100
    ----------------
    

    This is an AND operation, and both inputs (a) and (b) must be logical 1

    Boolean algebra basics