以下是引用HJin在2007-6-22 23:38:58的发言:
野比's way
[CODE]int* b=&a[0][0]; //a pointer to the start of the array
int** c=&b; //a pointer points to the pointer which points to the array... wow.....tongue twister... (^^!)
//now you can use the c pointer as the parameter of f() instead...[/CODE]
on my system gives access violation error. b points to the start of the 2d array, c is just the address of the b variable, so that
[CODE]c[2][2] = 1;[/CODE]
fails.
野比's way
[CODE]int* b=&a[0][0]; //a pointer to the start of the array
int** c=&b; //a pointer points to the pointer which points to the array... wow.....tongue twister... (^^!)
//now you can use the c pointer as the parameter of f() instead...[/CODE]
on my system gives access violation error. b points to the start of the 2d array, c is just the address of the b variable, so that
[CODE]c[2][2] = 1;[/CODE]
fails.
I think you misunderstand.
int *p[n];
p[n] = &a[0][0]
……
then
int **ptr = p;
try this.
Fight to win or die...