ProgrammingHard
printf("%d", 1 << 3 == 8); What is printed?
- A. 0
- B. 8
- C. 1
- D. 3
Correct answer: C. 1
The shift binds tighter than ==, so 1 << 3 is 8, which equals 8, giving 1.
More C Programming questions
- printf("%d", 5 & 6 == 4); What is printed?
- printf("%d", (2, 3) | 4); What is printed?
- printf("%lld", (3LL 1000000007 + 5) % 1000000007); What is printed?
- printf("%d", (1u << 31) / 2); What is printed with a 32-bit unsigned int?
- printf("%d", (unsigned short)70000); What is printed with a 16-bit unsigned short?
- printf("%d", 0xFF >> 1 & 0x0F); What is printed?