Quote Originally Posted by c99tutorial View Post
If you have a three dimensional array declared as `double A[x][y][z]' is it clearer to address an arbitrary element with indices a, b, c as

A[a][b][c] = foo;

or

*(((A+a*x*y)+b*x)+c) = foo;

? Especially when there are more than two dimensions, the bottom form becomes tedious and error prone.

Creating a function that operates on the array A will always require 4 parameters no matter if you use the pointer notation or the array notation: you need to pass one parameter representing the array A, and you need to pass three integer parameters representing the maximum bound of each dimension.

In other words, your choices for a function bar are pretty much just these two:

void bar1(int x, int y, int z, double *A);

void bar2(int x, int y, int z, double A[x][y][z]);
Wrong. You can not pass *A.

You pass the array as I said and you handle it normally (of course not as you say...)