当前位置:网站首页>* 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[].
边栏推荐
- error: . repo/manifests/: contains uncommitted changes
- Electronic Association C language level 1 33, odd even number judgment
- Construction and maintenance of business websites [11]
- Number of palindromes in C language (leetcode)
- [rust web rokcet Series 2] connect the database and add, delete, modify and check curd
- Software No.1
- Volume compression, decompression
- JMeter (I) - download, installation and plug-in management
- How can the tsingsee Qingxi platform play multiple videos at the same time on the same node?
- Develop those things: how to use go singleton mode to ensure the security of high concurrency of streaming media?
猜你喜欢

1069. Division of convex polygons (thinking, interval DP)

New news, Wuhan Yangluo international port, filled with black technology, refreshes your understanding of the port

Learn basic K-line diagram knowledge in three minutes

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

ES6 new method of string

Develop those things: how to use go singleton mode to ensure the security of high concurrency of streaming media?

Android: how can golden nine and silver ten squeeze into the first-line big factories from small and medium-sized enterprises? The depth of interview questions in large factories

Introduction to ffmpeg Lib

MPLS experiment operation

This is the report that leaders like! Learn dynamic visual charts, promotion and salary increase are indispensable
随机推荐
分卷压缩,解压
电子协会 C语言 1级 32、计算2的幂
Laravel artisan common commands
Quatre stratégies de base pour migrer la charge de travail de l'informatique en nuage
[rust web rokcet Series 1] Hello, world and get, post, put, delete
Android high frequency network interview topic must know and be able to compare Android development environment
MySQL view concept, create view, view, modify view, delete view
遊戲思考15:全區全服和分區分服的思考
What are the affordable Bluetooth headsets? Student party parity Bluetooth headset recommendation
Software No.1
Construction and maintenance of business websites [15]
The smart Park "ZhongGuanCun No.1" subverts your understanding of the park
企业应该选择无服务器计算吗?
Memorabilia of domestic database in June 2022
321. Chessboard segmentation (2D interval DP)
成功实现边缘编码需要了解的六大经验教训
uTools
【LeetCode 43】236. The nearest common ancestor of binary tree
2022 Q2 - Summary of skills to improve skills
迁移云计算工作负载的四个基本策略