两个声明之间的差异涉及指针和数组 [英] Difference between two declarations involving a pointer and an array

查看:131
本文介绍了两个声明之间的差异涉及指针和数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是 INT之间的差异* A [3] INT(*一)[3]

推荐答案

有数据类型为int a [3] 和 INT(A之间无差异)[3] ,他们都声明 A 为3 INT 秒的数组。有间为int * A [3] INT(*一)[3] ,前者声明一个区别3指针数组 INT 而第二个声明了一个指针指向3 INT 秒的数组。括号有所作为这里因为在C括号中有较高的precedence不是*。

There is no difference between int a[3] and int (a)[3], they both declare a as an array of 3 ints. There is a difference between int *a[3] and int (*a)[3], the former declares an array of 3 pointers to int whereas the second declares a pointer to an array of 3 ints. The parenthesis make a difference here because in C brackets have a higher precedence than *.

这篇关于两个声明之间的差异涉及指针和数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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