当前位置:网站首页>* and & symbols in C language
* and & symbols in C language
2022-07-02 01:51:00 【java_ prinln】
int a = 10;
int *b = &a;
printf(“%d\n”, a);
printf(“%d\n”, &a);
printf(“%d\n”, b);
printf(“%d\n”, *b);
result
10
6487620
6487620
10
Variable a Essentially represents a storage unit CPU The data in the storage unit is accessed through the address of the storage unit . therefore a Originally represents two values : The address of the storage unit and the data in the storage unit . So there is the opposite sex . To eliminate this ambiguity ,C Language policy a Represents the data in the storage unit ,&a Indicates the address of the storage unit .
a The data in the storage unit can be an ordinary value , It can also be the address of another storage unit , such as :a = &b; The statement is to b The address of the storage unit is stored in a In the storage unit .C Language policy a representative a Data in the storage unit corresponding to the address stored in , That is to visit a Equal to access b, therefore *a Provided through a visit b Means of data in .
a Express a Data in the corresponding storage unit .
&a Express a Address of the corresponding storage unit .
a Express : First , requirement a The data in the corresponding storage unit must be the address of another storage unit .
therefore ,a Represents data in another storage unit .
When a The type of declaration is int when ,a Stored in is an integer value , adopt a You can visit ( To read or modify ) The numerical .
When a The type of declaration is int when ,a Stored in is the address of a storage unit , The data stored in the storage unit is an integer value ; adopt a You can visit ( To read or modify ) The numerical .a == &*a Are the address of the storage unit .
When a The type of declaration is int** when ,a Stored in is the address of a storage unit , The data stored in this storage unit is the address of another storage unit , In addition, this storage unit stores an integer value ; adopt **a You can visit ( To read or modify ) The numerical .
Last , stay C In language, address is called pointer . also , stay C Arrays in language are actually pointers , namely :*a Equate to a[].
边栏推荐
- Six lessons to be learned for the successful implementation of edge coding
- Regular expression learning notes
- [Obsidian] wechat is sent to Obsidian using remotely save S3 compatibility
- SAP ui5 beginner tutorial 20 - explanation of expression binding usage of SAP ui5
- 自动浏览拼多多商品
- Should enterprises choose server free computing?
- np. Where and torch Where usage
- From January 11, 2007 to January 11, 2022, I have been in SAP Chengdu Research Institute for 15 years
- [Video] visual interpretation of Markov chain principle and Mrs example of R language region conversion | data sharing
- Construction and maintenance of business websites [11]
猜你喜欢

Learn basic K-line diagram knowledge in three minutes

This is the report that leaders like! Learn dynamic visual charts, promotion and salary increase are indispensable

【LeetCode 43】236. The nearest common ancestor of binary tree

Matlab uses audioread and sound to read and play WAV files

Six lessons to be learned for the successful implementation of edge coding

479. Additive binary tree (interval DP on the tree)

321. Chessboard segmentation (2D interval DP)

MySQL约束与多表查询实例分析

Penser au jeu 15: penser au service complet et au sous - service

Selection of field types for creating tables in MySQL database
随机推荐
321. Chessboard segmentation (2D interval DP)
MySQL约束与多表查询实例分析
The smart Park "ZhongGuanCun No.1" subverts your understanding of the park
电子协会 C语言 1级 32、计算2的幂
1218 square or round
现货黄金分析的技巧有什么呢?
Regular expression learning notes
跨域?同源?一次搞懂什么是跨域
Four basic strategies for migrating cloud computing workloads
What are the skills of spot gold analysis?
Construction and maintenance of business websites [12]
Modeling essays series 124 a simple coding method
Edge computing accelerates live video scenes: clearer, smoother, and more real-time
New news, Wuhan Yangluo international port, filled with black technology, refreshes your understanding of the port
479. Additive binary tree (interval DP on the tree)
The technology boss is ready, and the topic of position C is up to you
Matlab uses resample to complete resampling
Word search applet design report based on cloud development +ppt+ project source code + demonstration video
matlab 使用 resample 完成重采样
MySQL如何解决delete大量数据后空间不释放的问题