char *(* arr)[2]和char **数组[2]如何彼此不同?(how char * (*arr)[2 ] and char **array[2] are different from ea

系统教程 行业动态 更新时间:2024-06-14 17:01:34
char *(* arr)[2]和char **数组[2]如何彼此不同?(how char * (*arr)[2 ] and char **array[2] are different from each other?)

char * (*arr)[2]和char **array[2]彼此不同? 如果我使用函数传递char* strings[2]那么如何从第一部分提到的方式访问元素? 还请告诉其他访问指针数组元素的方法。 谢谢。

how char * (*arr)[2] and char **array[2] are different from each other ?? if I am passing char* strings[2] using a function then how to access the elements from both the ways mentioned in first part of question? Please also tell other ways to access elements of pointer array also. Thanks.

最满意答案

遵循螺旋规则 : -

a] char *(* arr)[2]

+------+ | +--+ | | | | | | ^ | | char * (*arr ) [2] | | | | | | | | | +----+ | +---------+ identifier arr is pointer to array of 2 pointer to char

b] char ** arr [2]

+----------+ | +----+ | | ^ | | char* *arr [2] | | | | | | +------+ | +------------+ identifier arr is an array 2 of pointers to pointer to char

同样的,

c] char * strings [2]

+-----+ | | ^ | char *strings [2] | | +--------+ identifier string is an array of 2 pointers to char

所以,知道分歧

Follow the spiral rule:-

a] char *(*arr)[2]

+------+ | +--+ | | | | | | ^ | | char * (*arr ) [2] | | | | | | | | | +----+ | +---------+ identifier arr is pointer to array of 2 pointer to char

b] char **arr[2]

+----------+ | +----+ | | ^ | | char* *arr [2] | | | | | | +------+ | +------------+ identifier arr is an array 2 of pointers to pointer to char

Similarly,

c] char* strings[2]

+-----+ | | ^ | char *strings [2] | | +--------+ identifier string is an array of 2 pointers to char

So, know figure out the differences

更多推荐

本文发布于:2023-04-20 18:59:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/e182f199ae1fe3279f39c89872befdc1.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数组   char   arr   array

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!