>void foo(int **two_d);
Bzzzt, wrong! That's not a two dimensional array. The following will not compile:
Code:
void foo(int **a);
int main()
{
int array[5][5];
foo(array);
}
The reason is because the whole "array name becomes a pointer" deal only works once per use, so the correct code would be:
Code:
void foo(int (*a)[5]);
int main()
{
int array[5][5];
foo(array);
}
Multidimensional arrays in C are tricky, so I usually recommend duplicating the original declaration in the parameter list:
Code:
void foo(int a[5][5]);
int main()
{
int array[5][5];
foo(array);
}
If you need a multidimensional array without the function knowing the size, you need to simulate a multidimensional array with pointers and memory allocation. Then your example will work, but only if the function's code has a way to get the size of all dimensions somehow.