当前位置:网站首页>* 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[].
边栏推荐
- Is the knowledge of University useless and outdated?
- Réseau neuronal convolutif (y compris le Code et l'illustration correspondante)
- 自动浏览拼多多商品
- matlab 使用 resample 完成重采样
- Word search applet design report based on cloud development +ppt+ project source code + demonstration video
- Discussion on the idea of platform construction
- 电商系统中常见的9大坑,你踩过没?
- MySQL view concept, create view, view, modify view, delete view
- Brief introduction to the development of mobile network
- MySQL约束与多表查询实例分析
猜你喜欢
With the innovation and upgrading of development tools, Kunpeng promotes the "bamboo forest" growth of the computing industry
matlab 使用 audioread 、 sound 读取和播放 wav 文件
Pyldavis installation and use | attributeerror: module 'pyldavis' has no attribute' gensim '| visual results are exported as separate web pages
卷積神經網絡(包含代碼與相應圖解)
Penser au jeu 15: penser au service complet et au sous - service
Word search applet design report based on cloud development +ppt+ project source code + demonstration video
Three core problems of concurrent programming
现货黄金分析的技巧有什么呢?
Introduction to ffmpeg Lib
[rust web rokcet Series 1] Hello, world and get, post, put, delete
随机推荐
KS006基于SSM实现学生成绩管理系统
Design and implementation of radio energy transmission system
"C language programming", 4th Edition, edited by he Qinming and Yan Hui, after class exercise answers Chapter 3 branch structure
并发编程的三大核心问题
C language 3-7 daffodils (enhanced version)
Construction and maintenance of business websites [13]
开发工具创新升级,鲲鹏推进计算产业“竹林”式生长
Ubuntu20.04 PostgreSQL 14 installation configuration record
【LeetCode 43】236. The nearest common ancestor of binary tree
"C language programming", 4th Edition, edited by he Qinming and Yan Hui, after class exercise answers Chapter 3 branch structure Exercise 3
734. Energy stone (greed, backpack)
电子协会 C语言 1级 32、计算2的幂
Number of palindromes in C language (leetcode)
2022 Q2 - Summary of skills to improve skills
Matlab uses resample to complete resampling
[Video] visual interpretation of Markov chain principle and Mrs example of R language region conversion | data sharing
Private project practice sharing [Yugong series] February 2022 U3D full stack class 009 unity object creation
Discussion on the idea of platform construction
如何用一款产品推动「品牌的惊险一跃」?
I Brief introduction of radio energy transmission technology