16. Bitwise Operations-III

Question.1

A developer defines a bit-toggle macro and uses it:

#define TOGGLE_BIT(reg, n)  ((reg) ^= (1 << (n)), (reg) & (1 << (n)))

uint8_t ctrl = 0x00;
uint8_t pos = 3;
TOGGLE_BIT(ctrl, pos++);

The developer expects to toggle bit 3 and check if it's now set. What actually happens?

Need Help? Refer to the Quick Guide below

Select Answer

Restart quiz!