ProgrammingHard
For the array int a[2][3] = {{1, 2, 3}, {4, 5, 6}}, what does *(*(a + 1) + 2) print?
- A. 5
- B. 3
- C. 6
- D. 4
Correct answer: C. 6
a + 1 points at the second row, *(a + 1) is that row's address, and adding 2 reaches the third element, which is 6.
More C Programming questions
- int m[2][3] = {{1, 2, 3}, {4, 5, 6}}; int (r)[3] = m + 1; What is r[0][2]?
- In an n x n row-major int matrix with n = 5, what is the flat index of the diagonal cell (i, i) for i = 2?
- On a 5 x 5 grid the number of cells on its boundary (first and last row, first and last column) is what?
- Which 2 x 2 product gives the top-left entry of A = [[1, 2], [3, 4]] times B = [[5, 6], [7, 8]]?
- A 3 x 3 grid has one blocked cell at row 1, column 1. How many right-or-down paths lead from the top-left to the bottom-right cell?
- The zigzag scan of the 3 x 3 matrix [[1,2,3],[4,5,6],[7,8,9]] along anti-diagonals, alternating direction (as in JPEG order), gives which…