What would be the equivalent pointer expression for referring the array element ar[m][n][o]?
- *(*(*(ar) + m + n) + o)
- (*(*(*(ar + m) + n) + o))
- (*(*(ar + m) + n) + o)
- *(*(*(ar + m) + n) + o)
🎥 Video solution / Text Solution of this question is given below:
Consider ar as a 3-dimensional array declared as:
data_type ar[a][b][c];
Here, the array element ar[m][n][o] can be represented in pointer form as:
*(*(*(ar + m) + n) + o)
Step-by-step understanding:
ar is a pointer to the first 2D array ar[0].
ar + m moves the pointer to the mth 2D array → ar[m].
*(ar + m) gives the address of the first 1D array inside ar[m].
*(ar + m) + n moves to the nth 1D array → ar[m][n].
*(*(ar + m) + n) gives the address of the first element of that 1D array.
*(*(*(ar + m) + n) + o) finally gives the element ar[m][n][o].
✅ Final Answer: *(*(*(ar + m) + n) + o)