Metalingus - 3 months ago 40

C Question

What is the MATHEMATICAL function that gives the address of an array with more than 3 dimensions?

I already know that for an array a[x][y] with 2 dimensions is (a+(x*max_second_dimension+y)*byte)

Answer

let dimension of array be `lxbxhxg`

which means array has declared using

```
data_type array[l][b][h][g];
```

if you want address of cell at `array[x][y][z][a]`

then it will be

```
array + (x*b*h*g + y*h*g + z*g + a) * sizeof(array[x][y][z][a])
```