ProgrammingHardInfosys · C

What is printed?

What is printed?
unsigned int x = 0xB4;
printf("%u %u", x & -x, x & (x - 1));
  1. A. 4 176
  2. B. 4 180
  3. C. 1 176
  4. D. 2 176

Correct answer: A. 4 176

x & -x isolates the lowest set bit (0xB4 = 10110100, so 4); x & (x - 1) clears that bit, giving 0xB0 = 176.

More C Programming questions

Exams that ask this topic