A bit is to be cleared without disturbing the others. The correct line is
Answer: C
Correct answer: reg &= ~(1u << n);
Shifting one into position and inverting gives a mask with a zero at that bit and ones everywhere else; ANDing with it clears the bit and leaves the rest untouched. OR would set the bit, XOR would toggle it, and plain assignment would destroy every other bit in the register.
Please log in or register to report this question.