ProgrammingHard
char g[2][3] = {"ab", "cde"}; printf("%c", g[1][2]); What is printed?
- A. e
- B. d
- C. c
- D. f
Correct answer: A. e
g[1] holds cde with no terminator needed, since it fills all three bytes. Its third character is e.
More C Programming questions
- int grid[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}; int s = 0; for (int i = 0; i < 3; i++) s += grid[i][2 - i]; printf("%d", s); What is…
- int a[4][4] = {0}; for (int i = 0; i < 4; i++) a[i][i] = a[i][3 - i] = 1; int c = 0; for (int i = 0; i < 4; i++) for (int j = 0; j < 4…
- A 5 x 5 grid is stored as an int matrix. Which expression gives the number of cells on its main diagonal?
- int n = 4; int m[n][n]; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) m[i][j] = i + j; printf("%d", m[3][3]); What is printed?
- Which statement about passing a 2D array to a function is correct in C99?
- int a[3][3]; printf("%zu", sizeof a[0][0] 3 3); What is printed with 4-byte int?