Question 3
Back to Exercise
What is the output of the following C program on a 64-bit system?
#include <stdio.h>
typedef int Row[4];
int main(void) {
Row grid[3];
printf("%zu %zu %zu\n", sizeof(Row), sizeof grid, sizeof grid / sizeof grid[0]);
return 0;
}
- A 16 48 3 Correct
- B 4 12 3
- C 16 48 4
- D 16 12 4
Correct Answer: Option A
A Row is 4 ints = 16 bytes. grid holds 3 Rows = 48 bytes, so it has 3 elements (rows).
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!