什么是INT(* PT)的意义[5]在C [英] What is the meaning of int (*pt)[5] in c
本文介绍了什么是INT(* PT)的意义[5]在C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我读过一些地方有关此类声明。
宣言是:
INT(* ARR)[5];
我很困惑,这种类型的点点declaration.Actually这是什么声明的意义,做的时候,我们使用它。
解决方案
为int *常用3 [5]
改编
5指针数组
INT(* ARR)[5]
改编
是一个指向5整数元素的数组
检查下code:
int类型的[5] = {1,2,3,4,5};
INT(*改编)[5] =&放大器;一个;
的printf(%D,(* ARR)[2]);
现在的数组元素可以像
访问 (* ARR)[我]
不是 *改编[I]
I Have read some where about this type declaration. Declaration is:
int (*arr)[5];
i'm little bit confused with this type declaration.Actually what is the meaning of this declaration and when do we use it.
解决方案
int *arr[5]
arr
is array of 5 pointers
int (*arr)[5]
arr
is a pointer to an array of 5 integer elements
Check the code below:
int a[5] = { 1,2,3,4,5};
int (*arr)[5] = &a;
printf("%d",(*arr)[2]);
Now the array element can be accessed like
(*arr)[i]
not *arr[i]
这篇关于什么是INT(* PT)的意义[5]在C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文