ProgrammingHardCompetitive coding (CP)

What is printed?

What is printed?
#include <stdio.h>
int main(void) {
    unsigned n = 44;
    while (n & (n - 1)) n &= n - 1;
    printf("%u", n);
}
  1. A. 32
  2. B. 8
  3. C. 44
  4. D. 4

Correct answer: A. 32

Clearing the lowest set bit repeatedly leaves only the highest set bit of 44 = 101100, which is 32.

More C Programming questions

Exams that ask this topic