We know that a[4][5] is a 2D matrix which has 4 rows and 5 columns,
Logical representation:
[0][0] [0][1] [0][2] [0][3] [0][4]
[1][0] [1][1] [1][2] [1][3] [1][4]
[2][0] [2][1] [2][2] [2][3] [2][4]
[3][0] [3][1] [3][2] [3][3] [3][4]
In memory:
(All multi-dimensional arrays in C get linearized in memory row by row as C standard mandated row major ordering for arrays)
[0][0] [0][1] [0][2] [0][3] [0][4] [1][0] [1][1] [1][2] [1][3] [1][4] [2][0] [2][1] [2][2] [2][3] [2][4] [3][0] [3][1] [3][2] [3][3] [3][4]
Let’s understand what *(a[1]+9) means:
It’s nothing but value at a[1][9] i.e value at 1st row 9th col. Now, we are not able to find this index that’ll be our next question. Since C doesn’t check for array index range it searches in row-major order so, we need to start from a[1][0] and move to 9th place from here in memory ([1][1] will be your 1st jump).
So, 9th place is [2][4] i.e [1][9] = [2][4]
Hence, 10 * 2 + 4 = 24 (Option C)