ProgrammingModerate
char s[][4] = {"ab", "xyz"}; printf("%zu", sizeof s); What is printed?
- A. 8
- B. 6
- C. 7
- D. 4
Correct answer: A. 8
The array has two rows of four chars each, so sizeof s is 8.
More C Programming questions
- enum { A = 3, B, C = 10, D }; printf("%d", B + D); What is printed?
- printf("%d", 1 ? 'a' : 0); What is printed?
- #define SQ(x) ((x) (x)) printf("%d", SQ(2 + 1)); What is printed?
- #define ADD(a, b) a + b printf("%d", ADD(1, 2) 3); What is printed?
- char grid[2] = {"ab", "cd"}; printf("%c", grid[1][0]); What is printed?
- struct S { int a; char c; } arr[2] = {{1}}; printf("%d", arr[1].a); What is printed?