1

I need help with ANDing two hex values but my approach is not working.

Question - Evaluate the following Expression 0x77 && 0x12

My Attempt I was told that you can divide up each hex digit into 4 blocks. This worked for bigger values such as 77 but as you can see the method doesn't work for 12. Is this the right approach?

7 = 0111    7= 0111     77=01110111

1 = 0001    2=0010      12=00010010  

0x77 && 0x12

  01110111
& 00010010  

  00010010
Ninja2k
  • 195
  • 1
    Why do you think that something is wrong here? 0x77 & 0x12 = 0x12 is perfectly all right. The only issue is the inconsistent usage of & and &&. If you try to verify the results on a computer, make sure that you use the correct operator for bitwise AND. – Reinhard Meier Mar 01 '17 at 18:59
  • My instructor must have written the answer wrong! – Ninja2k Mar 01 '17 at 19:09

0 Answers0