C指针,指向指针消歧的阵列/阵列 [英] C pointer to array/array of pointers disambiguation

查看:163
本文介绍了C指针,指向指针消歧的阵列/阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是下面的声明的区别是:

 为int * ARR1 [8];
INT(* ARR2); [8]
为int *(ARR3 [8]);

什么是理解更复杂的声明的一般规则?


解决方案

 为int *常用3 [8]; // INT指针数组。
INT(*改编); [8] //一个指向整数数组

第三个是与第一

一般的规则是运营商precedence 。作为函数指针进入画面就可以得到,甚至要复杂得多。

What is the difference between the following declarations:

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 third one is same as the first.

The general rule is operator precedence. It can get even much more complex as function pointers come into the picture.

这篇关于C指针,指向指针消歧的阵列/阵列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆