ProgrammingVery hard
unsigned int a = 3, b = 5; printf("%u", a - b + 3); What is printed on a 32-bit platform?
- A. 4294967295
- B. 2
- C. 0
- D. 1
Correct answer: D. 1
3 - 5 wraps to 4294967294 in unsigned arithmetic, and adding 3 wraps again to 1.
More C Programming questions
- printf("%d", -1 < 1u); What is printed?
- What is the number of subsets of {0, 1, 2, 3, 4} whose element sum is even (the empty set counts)?
- The Gray code 0b110 is converted to ordinary binary using the prefix XOR rule. What is the decimal result?
- What does printf("%d", 8 & 7 == 0); print?
- How many integers from 1 to 10^9 are divisible by 7 or by 11?
- The modular inverse of 2 modulo the NTT prime 998244353 is which value?