指向指针数组的指针 [英] Pointer to Array of Pointers
本文介绍了指向指针数组的指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 int 指针数组 int* arr[MAX];
我想将它的地址存储在另一个变量中.如何定义指向指针数组的指针?即:
I have an array of int pointers int* arr[MAX];
and I want to store its address in another variable. How do I define a pointer to an array of pointers? i.e.:
int* arr[MAX];
int (what here?) val = &arr;
推荐答案
应该是:
int* array[SIZE];
int** val = array;
无需在 array
上使用地址运算符,因为数组会衰减为赋值运算符右侧的隐式指针.
There's no need to use an address-of operator on array
since arrays decay into implicit pointers on the right-hand side of the assignment operator.
这篇关于指向指针数组的指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文