当前位置:网站首页>Is the pointer symbol of C language close to variable type or variable name?
Is the pointer symbol of C language close to variable type or variable name?
2022-04-23 10:33:00 【Ape knowledge】
Today, while reviewing the data structure ,C Language implementation of linear table uses pointers , Doubt about the position of the pointer symbol , So I inquired :
stay C As long as pointers are used in language , It is necessary to use * Operator . Then you often see in different books * There are close to variable types , There is a close to the variable name , I'm confused about the difference between the two . Later, I checked on the Internet , Summarized below :
On the whole ,* Close to any one , Compilers will think of pointer variables , So the essence is the same . But the two forms have different advantages .
int* p;
This can be interpreted as p yes int Pointer to type . And the next one
int *p;
It can be understood as having a pointer p yes int type , In fact int Just a pointer to a type .
however int* p This type is used when more variable names are defined , Easy to misunderstand . for example :
int* p,q;
The meaning of this sentence is p yes int Pointer variable of type , and q It's just int Type variable . This form is equivalent to
int *p,q; // namely int *p,int q
therefore , under these circumstances , Can be * Close to variable name , Instead of variable types . as follows :
int *p,q;
This will not produce ambiguity . Of course , If you write in a few more lines, you won't have this problem , Certainly. .
版权声明
本文为[Ape knowledge]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230619310681.html
边栏推荐
- Arbitrary file reading vulnerability exploitation Guide
- Arm debugging (1): two methods to redirect printf to serial port in keil
- Detailed explanation of MapReduce calculation process
- Contact between domain name and IP address
- Read LSTM (long short term memory)
- 任意文件读取漏洞 利用指南
- 得到知识服务app原型设计比较与实践
- Sim Api User Guide(5)
- Using multithreading to output abc10 times in sequence
- C#和数据库连接中类的问题
猜你喜欢
How does the swagger2 interface import postman
IDEA——》每次启动都会Indexing或 scanning files to index
第120章 SQL函数 ROUND
How can swagger2 custom parameter annotations not be displayed
Swagger2 接口如何导入Postman
MapReduce compression
Example of pop-up task progress bar function based on pyqt5
Xshell+Xftp 下载安装步骤
/Can etc / shadow be cracked?
JUC concurrent programming 06 -- in-depth analysis of AQS source code of queue synchronizer
随机推荐
Sim Api User Guide(8)
/Can etc / shadow be cracked?
Introduction to wechat applet, development history, advantages of applet, application account, development tools, initial knowledge of wxml file and wxss file
Configuration of LNMP
Shell script interaction free
App. In wechat applet JS files, components, APIs
Juc并发编程09——Condition实现源码分析
997、有序数组的平方(数组)
Sim Api User Guide(5)
二叉树的构建和遍历
MapReduce core and foundation demo
59. Spiral matrix (array)
CSP certification 202203-2 travel plan (multiple solutions)
Exercise questions and simulation test of refrigeration and air conditioning equipment operation test in 2022
Juc并发编程07——公平锁真的公平吗(源码剖析)
JUC concurrent programming 06 -- in-depth analysis of AQS source code of queue synchronizer
349. Intersection of two arrays
Wonderful review | deepnova x iceberg meetup online "building a real-time data Lake based on iceberg"
242、有效字母异位词(哈希表)
454、四数之和(哈希表)