I understand OP's question, at least i think i understand. but might be not quite.
1. if OP wants to change the pointer itself (not the value that the pointer points to), a char*&, or char** is a must.
2. in OP's case, it doesn't work, because no way to take a reference of an array in C++.
3. an alternative is to put your array dynamically on the heap, rather than statically on stack. then you can use char** .
4. for 3. OP need a smart pointer to handle the ownership issue, if necessary.
1 2 3 4 5 6 7 8 9 10 11
|
void seearr(int* a[]){
cout<<&a<<endl;
}
int main(int argc, char* argv[]){
int b1;
int b2;
int* ap[]={&b1, &b2};
cout<<&ap<<endl;
seearr(ap);
}
| |
main::ap and seearr::a, have definitely different address, a is only a copy of ap.
but, there is no way to change ap if it is an static array, that's why no reference to array is allowed.
you need to use "new".