Question 12
Back to Exercise
What is the output of the following program, compiled as C23?
#include <stdio.h>
int main(void) {
unsigned _BitInt(8) x = 255;
x += 2;
printf("%zu %zu %d\n", sizeof(true), sizeof(unsigned _BitInt(8)), (int) x);
return 0;
}
- A 4 1 257
- B 1 1 1 Correct
- C 4 1 1
- D 1 8 257
Correct Answer: Option B
In C23 true has type bool, whose size is 1 (in C17 it was the int 1, size 4). An unsigned 8-bit _BitInt is 1 byte and wraps modulo 256: 255 + 2 = 257 → 1.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!