当前位置:网站首页>如何理解指针?
如何理解指针?
2022-07-21 06:45:00 【Chaosna13】
刚接触指针着一个概念的时候,相信很多初学者都是不知所云,感觉跟以往所学的语言知识相违背,其实不然。
我们这里定义一个指针
int i;
int* p =&i;
这里p是指针,指向了i这个变量。那为什么p是指针,而不是*p是指针呢?
这样写你可能就清楚了。
int *p =&i;//注意*的位置
不是把*号加给了int,而是把*号加给了p,*p是一个int,于是p是一个指针了
*p是int类型的变量(取值)
p是指针(取址)
指针变量的值是内存的地址 普通变量的值是实际的值 指针变量的值是具有实际值变量的地址
边栏推荐
猜你喜欢
随机推荐
Steve Aoki 的人物化身将来到 The Sandbox 元宇宙!
Leetcode [sword finger offer II 068. find the insertion position
怎么学自动化测试,可以自学吗?
(pytorch进阶之路七)Attention Based Seq2Seq
Malloc et configurateur d'espace
分析少儿编程思维的启蒙问题
Vs2022 shortcut key settings
Interpreting the maker education model in line with the mainstream of the new era
[network security] common questions in interview -- SQL injection
Introduction to common interfaces of vector
IP 地址段分类
Detailed explanation and typical cases of multi-agent system cluster collaborative control experimental platform
list解析<stl初级> (跑路人笔记)
DOM -- style operation
多智能体系统集群协同控制实验平台详解与典型案例
牛客刷题 01——KiKi去重整数并排序(C语言)
New features of mqtt5.0 (compare with 3.1.1)
逍遙管理器安裝
第一讲 概述
"Core engine" of Technology