puzzlecracker <ir*********@gmail.comwrites:
int a[3][9];
f(a);
void f(int** x)
{
//do something with a
}
You have a type miss-match. 'a' is an array (of length 3) whose
elements are arrays of 9 ints. 'f' must be passed a pointer to a
pointer to int. There is no implicit conversion that allows 'a' to be
passed to 'f'.
The parameter could be declared like this:
void f(int x[][9]);
or alternatively,
void f(int (*x)[9]);
The reasons are messy. In most contexts, expressions of type "array
of T" are converted to "pointer to T" (so void f(int *x) is correct
when passing an array of ints) but this conversion applies only to the
outer array type. The 'a' in 'f(a)' is therefore converted to a value
of type "pointer to array of 9 int" and not "pointer to pointer to
int".
--
Ben.