当前位置:网站首页>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
边栏推荐
- Jinglianwen technology - professional data annotation company and intelligent data annotation platform
- CentOS/Linux安装MySQL
- Arm debugging (1): two methods to redirect printf to serial port in keil
- CSP certification 202203-2 travel plan (multiple solutions)
- Six practices of Windows operating system security attack and defense
- 202. Happy number
- Windows installs redis and sets the redis service to start automatically
- Installing MySQL with CentOS / Linux
- 部署jar包
- JUC concurrent programming 06 -- in-depth analysis of AQS source code of queue synchronizer
猜你喜欢

Sim Api User Guide(5)

Operation of 2022 tea artist (primary) test question simulation test platform

Juc并发编程07——公平锁真的公平吗(源码剖析)

Redis design and Implementation

Yarn resource scheduler

/Can etc / shadow be cracked?

【leetcode】107.二叉树的层序遍历II

Swagger2 自定义参数注解如何不显示

解决方案架构师的小锦囊 - 架构图的 5 种类型
![Jerry's more accurate determination of abnormal address [chapter]](/img/ed/a08949bfc63823baf25fd57c324996.png)
Jerry's more accurate determination of abnormal address [chapter]
随机推荐
Swagger2 接口如何导入Postman
Shell script interaction free
得到知识服务app原型设计比较与实践
Introduction to wechat applet, development history, advantages of applet, application account, development tools, initial knowledge of wxml file and wxss file
Comparison and practice of prototype design of knowledge service app
How does the swagger2 interface import postman
【leetcode】102. Sequence traversal of binary tree
209. Subarray with the smallest length (array)
707. Design linked list (linked list)
Chapter 3 enable and adjust the size of IM column storage (im-3.1)
Realizing data value through streaming data integration (5) - stream processing
203. Remove linked list elements (linked list)
【leetcode】102.二叉树的层序遍历
ansible 云计算 自动化 命令行精简版
利用多线程按顺序连续输出abc10次
Comparison and practice of prototype design of knowledge service app
Define linked list (linked list)
微信小程序简介、发展史、小程序的优点、申请账号、开发工具、初识wxml文件和wxss文件
What are the system events of Jerry's [chapter]
Chapter 120 SQL function round