Skip to content
CSCosmos
C // COSMOS
memory workbench
Overview
Learn
Lab
Problems
Toggle theme
Arena
Masks, Flags & Bit Manipulation
← 33
35 →
DRILL 34
Medium
Setting a Bit
Which expression sets bit 2 of x while leaving the other bits unchanged?
Choose an answer
A
x |= (1u << 2);
B
x &= (1u << 2);
C
x ^= (1u << 2);
D
x = ~(1u << 2);
Show hint