当前位置:网站首页>* 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[].
边栏推荐
- Android: the kotlin language uses grendao3, a cross platform app development framework
- Regular expression learning notes
- Matlab uses resample to complete resampling
- Matlab uses audioread and sound to read and play WAV files
- There are spaces in the for loop variable in the shell -- IFS variable
- MATLAB realizes voice signal resampling and normalization, and plays the comparison effect
- The smart Park "ZhongGuanCun No.1" subverts your understanding of the park
- Six lessons to be learned for the successful implementation of edge coding
- Develop those things: how to use go singleton mode to ensure the security of high concurrency of streaming media?
- 企业应该选择无服务器计算吗?
猜你喜欢

遊戲思考15:全區全服和分區分服的思考

卷積神經網絡(包含代碼與相應圖解)

Introduction to ffmpeg Lib

mysql列转行函数指的是什么

Basic concepts of machine learning

Selection of field types for creating tables in MySQL database

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

Matlab uses resample to complete resampling

如何用一款产品推动「品牌的惊险一跃」?

ES6 new method of string
随机推荐
Bat Android Engineer interview process analysis + restore the most authentic and complete first-line company interview questions
The concepts and differences between MySQL stored procedures and stored functions, as well as how to create them, the role of delimiter, the viewing, modification, deletion of stored procedures and fu
Construction and maintenance of business websites [14]
It's already 30. Can you learn programming from scratch?
Feature extraction and detection 16 brisk feature detection and matching
牛客网——华为题库(51~60)
NeRV: Neural Reflectance and Visibility Fields for Relighting and View Synthesis
I Brief introduction of radio energy transmission technology
遷移雲計算工作負載的四個基本策略
Penser au jeu 15: penser au service complet et au sous - service
Matlab uses resample to complete resampling
Discussion on the idea of platform construction
error: . repo/manifests/: contains uncommitted changes
自动浏览拼多多商品
This is the report that leaders like! Learn dynamic visual charts, promotion and salary increase are indispensable
MySQL约束与多表查询实例分析
Implementation principle of city selector component
Matlab uses audiorecorder and recordblocking to record sound, play to play sound, and audiobook to save sound
Construction and maintenance of business websites [10]
Architecture evolution from MVC to DDD