- 函数形参是二级指针,可以传入的参数——二级指针变量本身/一级指针变量的地址
#includeusing namespace std; void test1(int **ptr) { cout << **ptr << endl; } void test2(char **p) { } int main() { int n = 10; int *p = &n; int **pp = &p; //二级指针 int* arr[10]; //指针数组,数组元素是指针 test1(pp); //正确 test1(&p); //正确 test1(arr); //正确 因为数组名是首元素地址,那也就是指针地址, //——————————————————————————————————————————————————————————————————————// char c = 'w'; char* pc = &c; char** ppc = &pc; char* arr1[10]; test2(ppc); //正确 test2(&pc); //正确 test2(arr1); //正确 system("pause"); return 0; }



