ProgrammingVery hard
printf("%d", -1 < 1u); What is printed?
- A. 0
- B. 1
- C. 2
- D. undefined behaviour
Correct answer: A. 0
The -1 is converted to unsigned int, which is larger than 1, so the comparison is false.
More C Programming questions
- 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?
- A linear congruential generator x = (1103515245 x + 12345) mod 2^31 starts with x = 1. What is the next value?