For a single dimensional array a
Address of the first element = &a[0] = a
Value in the first element = a[0] = *a
This can be extended to any number of dimensions.
- is clear.
- *(*(*(a+3) + 4) + 5)
*(*(a[3] + 4) + 5)
*( a[3] [4]) + 5)
a[3] [4] [5]
- See 2.
- Assuming the array is stored in RMO (default in C)
*((int*)a + 3 * 20 * 30 + 4 * 30 + 5)
Recall how we calculate the address of an index[i,j]? By skipping i rows and j columns from base address.
=> By skipping (i * size of row) elements + j elements from base address
=> base address + ((i * size of row) + j) elements
The same is being done here for three dimensional arrays, which gives the element at a[3][4][5]
Hence, Option D