Assume we have these declarations:
int** a;
int b[x][y];
Can I implement a function
foo f(bar c) {}
that lets me
f(a);
f(b);
without needing to overload it?
Assume we have these declarations:
int** a;
int b[x][y];
Can I implement a function
foo f(bar c) {}
that lets me
f(a);
f(b);
without needing to overload it?
Sure, just use void* :)
And to answer your question, no. A multidimentional array is not the same as a pointer to a pointer. The reason is the indexing scheme. int b [2][2] is a continuous memory block of 4 integers. Indexing into it is equivalent to the following:
b[i][j] == *(b + 2*i + j)
The second dimension is part of the type defintion! The compiler knows that it only needs one dereference due to the memory layout of the array.
Meanwhile, for int** a the indexing is done like this:
a[i][j] == *(*(a+i)+j)