当前位置:网站首页>指针数组与数组指针的区分
指针数组与数组指针的区分
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
边栏推荐
- Matlab 2019 installation of deep learning toolbox model for googlenet network
- Why is PostgreSQL about to surpass SQL Server?
- Android Development: the client obtains the latest value in the database in real time and displays it on the interface
- Encyclopedia of professional terms and abbreviations in communication engineering
- Customize the non slidable viewpage and how to use it
- 考试系统进入试卷优化思路
- Use of fluent custom fonts and pictures
- [报告] Microsoft :Application of deep learning methods in speech enhancement
- 深度学习——特征工程小总结
- RuntimeError: Providing a bool or integral fill value without setting the optional `dtype` or `out`
猜你喜欢
OpenHarmony开源开发者成长计划,寻找改变世界的开源新生力!
Matlab 2019 installation of deep learning toolbox model for googlenet network
MySQL syntax collation (5) -- functions, stored procedures and triggers
mysql通过binlog恢复或回滚数据
Class loading mechanism
Lottery applet, mother no longer have to worry about who does the dishes (assign tasks), so easy
redis优化系列(三)解决主从配置后的常见问题
MySQL syntax collation (2)
Class loading process of JVM
开关电源设计分享及电源设计技巧图解
随机推荐
openlayers draw矩形
SSDB foundation 2
Some ideas about time-consuming needs assessment
Executor、ExecutorService、Executors、ThreadPoolExecutor、Future、Runnable、Callable
SSDB foundation 1
openlayers 5.0 离散聚合点
MySQL practical skills
JS calculation time difference
js上传文件时控制文件类型和大小
Parsing headless jsonarray arrays
Hot reload debugging
Kubernetes入门到精通-KtConnect(全称Kubernetes Toolkit Connect)是一款基于Kubernetes环境用于提高本地测试联调效率的小工具。
OpenHarmony开源开发者成长计划,寻找改变世界的开源新生力!
C1000k TCP connection upper limit test 1
MySQL lock
Tencent cloud GPU best practices - remote development training using jupyter pycharm
How to select the third-party package of golang
Switching power supply design sharing and power supply design skills diagram
Installation, use and problem summary of binlog2sql tool
Class loading mechanism