ProgrammingHardGATE CS · Campus placements
What does printf("%d", '0' < '9') print?
- A. 0
- B. 9
- C. 48
- D. 1
Correct answer: D. 1
The digit characters are guaranteed to be contiguous and increasing in every conforming character set, so '0' < '9' is true and prints 1.
More C Programming questions
- What does printf("%d", 6 % 4 2) print?
- Which expression computes ceil(a / b) for positive int a = 7 and b = 3 using integer arithmetic, written as ((a + b - 1) / b)?
- int a[3][4]; for (int i = 0; i < 3; i++) for (int j = 0; j < 4; j++) a[i][j] = i 4 + j; printf("%d", (&a[0][0] + 7)); What is printed?
- With int a[3][4] (4-byte int, row-major), what is the value of (int )&a[1][0] - (int )&a[0][0]?
- With int a[3][4] (4-byte int) and int (p)[4] = a, what is (char )(p + 2) - (char )p?
- Matrix m = {{1,2,3},{4,5,6},{7,8,9}} is rotated 90 degrees clockwise. What is the first row after rotation?