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 charb] 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 charb] char **arr[2]
+----------+ | +----+ | | ^ | | char* *arr [2] | | | | | | +------+ | +------------+ identifier arr is an array 2 of pointers to pointer to charSimilarly,
c] char* strings[2]
+-----+ | | ^ | char *strings [2] | | +--------+ identifier string is an array of 2 pointers to charSo, know figure out the differences
更多推荐
发布评论