当前位置:网站首页>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
边栏推荐
- /etc/shadow可以破解吗?
- Solve the problem of installing VMware after uninstalling
- Jerry's users how to handle events in the simplest way [chapter]
- Introduction to wechat applet, development history, advantages of applet, application account, development tools, initial knowledge of wxml file and wxss file
- SQL Server cursor circular table data
- SSH uses private key to connect to server without key
- Realize data value through streaming data integration (2)
- Jerry's factors that usually affect CPU performance test results are: [article]
- Arm debugging (1): two methods to redirect printf to serial port in keil
- 中职网络安全2022国赛之CVE-2019-0708漏洞利用
猜你喜欢

【leetcode】199.二叉树的右视图

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

【leetcode】102. Sequence traversal of binary tree

基于PyQt5实现弹出任务进度条功能示例

Yarn resource scheduler

精彩回顾 | DEEPNOVA x Iceberg Meetup Online《基于Iceberg打造实时数据湖》

Comparison and practice of prototype design of knowledge service app

Shell script interaction free

Sim Api User Guide(5)

Swagger2 接口如何导入Postman
随机推荐
Chapter 1 Oracle database in memory related concepts (im-1.1)
349. Intersection of two arrays
[provincial election joint examination 2022 d2t1] card (state compression DP, FWT convolution)
Juc并发编程09——Condition实现源码分析
Realizing data value through streaming data integration (5) - flow analysis
206. Reverse linked list (linked list)
Ansible playbook syntax and format automate cloud computing
209. Subarray with the smallest length (array)
Sim Api User Guide(5)
ansible 云计算 自动化 命令行精简版
203、移出链表元素(链表)
242. Valid Letter ectopic words (hash table)
59、螺旋矩阵(数组)
Chapter II in memory architecture (im-2.2)
Jinglianwen technology - professional data annotation company and intelligent data annotation platform
LeetCode 1249. Minimum remove to make valid parents - FB high frequency question 1
142. Circular linked list||
707. Design linked list (linked list)
C language - custom type
【leetcode】102. Sequence traversal of binary tree