C 指向数组/指针数组的指针消歧 [英] C pointer to array/array of pointers disambiguation
本文介绍了C 指向数组/指针数组的指针消歧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下声明有什么区别:
int* arr1[8];
int (*arr2)[8];
int *(arr3[8]);
理解更复杂的声明的一般规则是什么?
What is the general rule for understanding more complex declarations?
推荐答案
int* arr[8]; // An array of int pointers.
int (*arr)[8]; // A pointer to an array of integers
第三个和第一个一样.
一般规则是运算符优先级.随着函数指针的出现,它会变得更加复杂.
The general rule is operator precedence. It can get even much more complex as function pointers come into the picture.
这篇关于C 指向数组/指针数组的指针消歧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文