ProgrammingVery hard
printf("%d", 3 > 2 ? 'Y' : 'N'); What is printed?
- A. Y
- B. N
- C. 1
- D. 89
Correct answer: D. 89
The conditional operator yields the character 'Y', which promotes to int 89 in a %d conversion.
More C Programming questions
- char names[] = {"x", "yy", "zzz"}; printf("%zu", strlen(names[2])); What is printed?
- int a[4] = {4, 3, 2, 1}; int s = 0; for (int i = 0; i < 4; i++) s = s 10 + a[i]; printf("%d", s); What is printed?
- int i = 1; int s = 0; while (i <= 4) s += i++; printf("%d", s); What is printed?
- int n = 0; do { n += 2; } while (n < 7); printf("%d", n); What is printed?
- unsigned char c = 0; c -= 1; printf("%d", c); What is printed?
- int m = 2147483647; printf("%d", m / 2); What is printed with a 32-bit int?