当前位置:网站首页>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
边栏推荐
- Jerry sometimes finds that the memory has been tampered with, but there is no exception. How should he find it? [chapter]
- 图像处理——噪声小记
- How can swagger2 custom parameter annotations not be displayed
- Juc并发编程09——Condition实现源码分析
- 209. Subarray with the smallest length (array)
- Yarn core parameter configuration
- Chapter 3 enable and adjust the size of IM column storage (im-3.1)
- MySQL common statements
- SQL Server 递归查询上下级
- /Can etc / shadow be cracked?
猜你喜欢
JUC concurrent programming 06 -- in-depth analysis of AQS source code of queue synchronizer
MySQL how to merge the same data in the same table
lnmp的配置
【省选联考 2022 D2T1】卡牌(状态压缩 DP,FWT卷积)
【leetcode】199.二叉树的右视图
Question bank and answers of Shanghai safety officer C certificate examination in 2022
Six practices of Windows operating system security attack and defense
Yarn resource scheduler
JUC concurrent programming 07 -- is fair lock really fair (source code analysis)
Jinglianwen technology - professional data annotation company and intelligent data annotation platform
随机推荐
What about Jerry's stack overflow? [chapter]
19. Delete the penultimate node of the linked list (linked list)
JVM——》常用命令
【leetcode】102.二叉树的层序遍历
Swagger2 自定义参数注解如何不显示
Yarn resource scheduler
CSP certification 202203-2 travel plan (multiple solutions)
Zhengda international explains what the Dow Jones industrial index is?
Jerry's factors that usually affect CPU performance test results are: [article]
How does the swagger2 interface import postman
19、删除链表的倒数第N个节点(链表)
图像处理——噪声小记
LeetCode-608. 树节点
202、快乐数
203. Remove linked list elements (linked list)
997. Square of ordered array (array)
MySQL common statements
景联文科技—专业数据标注公司和智能数据标注平台
Solution architect's small bag - 5 types of architecture diagrams
Jerry's users how to handle events in the simplest way [chapter]