当前位置:网站首页>指针数组与数组指针的区分
指针数组与数组指针的区分
2022-04-23 19:24:00 【ToneChip】
下面到底哪个是数组指针,哪个是指针数组呢:
A)
int *p1[10];
B)
int (*p2)[10];
每次上课问这个问题,总有弄不清楚的。这里需要明白一个符号之间的优先级问题。
A)“[]”的优先级比“*”要高。p1 先与“[]”结合,构成一个数组的定义,数组名为p1,int *修饰的是数组的内容,即数组的每个元素。那现在我们清楚,这是一个数组,其包含10 个指向int 类型数据的指针,即指针数组
B),在这里“()”的优先级比“[]”高,“*”号和p2 构成一个指针的定义,指针变量名为p2,int 修饰的是数组的内容,即数组的每个元素。数组在这里并没有名字,是个匿名数组。那现在我们清楚p2 是一个指针,它指向一个包含10 个int 类型数据的数组,即数组指针
版权声明
本文为[ToneChip]所创,转载请带上原文链接,感谢
https://tonechip.blog.csdn.net/article/details/122898659
边栏推荐
- OpenHarmony开源开发者成长计划,寻找改变世界的开源新生力!
- The usage of slice and the difference between slice and array
- Installation, use and problem summary of binlog2sql tool
- Common processing of point cloud dataset
- How to select the third-party package of golang
- FTP, SSH Remote Access and control
- NiO related Basics
- Some ideas about time-consuming needs assessment
- Speculation on the way to realize the smooth drag preview of video editing software
- Openlayers 5.0 loading ArcGIS Server slice service
猜你喜欢
White screen processing method of fulter startup page
Common SQL commands
Switching power supply design sharing and power supply design skills diagram
NiO related Basics
[报告] Microsoft :Application of deep learning methods in speech enhancement
開關電源設計分享及電源設計技巧圖解
[record] typeerror: this getOptions is not a function
Kubernetes入门到精通-裸机LoadBalence 80 443 端口暴露注意事项
SQL常用的命令
Intuitive understanding of the essence of two-dimensional rotation
随机推荐
Kubernetes入门到精通-裸机LoadBalence 80 443 端口暴露注意事项
Use of fluent custom fonts and pictures
How to use go code to compile Pb generated by proto file with protoc Compiler Go file
Codeforces Round #784 (Div. 4)
js上传文件时控制文件类型和大小
C1000k TCP connection upper limit test
arcMap 发布切片服务
MySQL syntax collation (2)
[record] typeerror: this getOptions is not a function
I just want to leave a note for myself
RuntimeError: Providing a bool or integral fill value without setting the optional `dtype` or `out`
MySQL practical skills
Redis core technology and practice 1 - start with building a simple key value database simplekv
Oracle配置st_geometry
MySQL syntax collation
Lottery applet, mother no longer have to worry about who does the dishes (assign tasks), so easy
Codeforces Round #783 (Div. 2) D题解
SQL常用的命令
The difference between underline and dot of golang import package
网络协议之:sctp流控制传输协议