ProgrammingHard

What is the value of ~5 & 0xF in C, with int of 32 bits?

  1. A. 11
  2. B. 5
  3. C. 6
  4. D. 10

Correct answer: D. 10

~5 is -6, whose low four bits are 1010, which is 10 in decimal.

More C Programming questions

Exams that ask this topic