In C23, what is the value of 0b0001'0100?
C23 standardises binary literals (0b) and allows ' as a digit separator, which is ignored by the compiler. 0001 0100 in binary is 16 + 4 = 20.
Bitwise Operators · Exercise 1 of 4
Twelve multiple-choice questions on the bitwise operators, masks, shifts and their undefined cases, precedence, integer promotion and C23 literals. Pick an option to check your answer instantly.
In C23, what is the value of 0b0001'0100?
C23 standardises binary literals (0b) and allows ' as a digit separator, which is ignored by the compiler. 0001 0100 in binary is 16 + 4 = 20.
For unsigned char c = 0x0F;, what are the type and value of ~c?
Before ~ is applied, c is promoted to int (0x0000000F). Flipping all 32 bits gives 0xFFFFFFF0, which as an int is −16. Cast back – (unsigned char) ~c – to get 240.
Timed online tests with instant scores and explanations.