Actually with 2D arrays, they aren't the same as pointer-to-pointers.
Try this:
Code:
#include <stdio.h>
int f1( int a[3][3] )
{
return a[1][1];
}
int f2( int* a[3] )
{
return a[1][1];
}
int f3( int** a )
{
return a[1][1];
}
int main()
{
int a[3][3] = { {1,2,3}, {4,5,6}, {7,8,9} };
printf( "a = %d", f1( a ) );
printf( "a = %d", f2( (int**)a ) ); /* Boom! */
printf( "a = %d", f3( (int**)a ) ); /* Boom! */
return 0;
}
I think it's blowing up because when f2() & f3() try to dereference a they assume that the value stored in a[1] is a pointer, so they dereference the value of a[1] which isn't a valid address.