当前位置:网站首页>Now you must know the pointer
Now you must know the pointer
2022-06-12 13:47:00 【Disobey the law】
Don't want to learn , Don't want to push mathematical formulas , So let's look at the pointer again , This time it seems that I really understand !!
If there is any problem, please d I , I'll change it right away !! Help every dream
If you talk about the pointer again, you will crack
& It's an address character ,& The variable represents the address of the variable
* Pointer name It refers to the content of the space corresponding to this pointer / The space corresponding to the pointer
&(* Pointer name ) It refers to the address of the space corresponding to this pointer
Pointer name and &(* Pointer name ) The effect is the same , Is the pointer to the address of that space
The address of a pointer itself ( Space for storing pointers ) The pointer is defined the moment it is created , Do not modify .
But the pointer to space can be modified .
int k = 2;
int* a = new int();
//*a Is the newly allocated space
cout << &k << endl;
cout << &a << endl;
cout << &(*a) << endl;
cout << a << endl;
//&a Is a pointer a The address of ,&k yes int type k The address of , Defining variables automatically assigns addresses to variables
// &(*a) Is the address of the space pointed to by the pointer , therefore p=p->next Is to modify p Pointer pointing
// The above three addresses are different , The last two are the same
a = new int();
cout << &(*a) << endl;
// here &(*a) With no reallocation of space &(*a) Dissimilarity , current &(*a) Is the newly allocated space , That is, the space to which the pointer points again

Take a look at the picture 
Add a little more
&b: refer to b The address of ,
&&b : Store b The address of
*b : take b Value pointing to space .
(*p).name and p->name Same ,*p Is the space pointed to by the pointer ,.a This is the space a Elements .p->name Namely p In this space a Elements .
边栏推荐
- 将字符串转为16进制字符串并显示出来
- Cocoapods的相关知识点
- Resume NFT platform trustrecruit joined Octopus network as a candidate application chain
- Talk about the top 10 classic MySQL errors
- Player screen orientation scheme
- Acwing: topology sequence
- Return value of WaitForSingleObject
- Data type conversion and conditional control statements
- Application of bit operation in C language
- Rk3399 platform development series explanation (kernel debugging chapter) 2.50 use of systrace
猜你喜欢

C#DBHelper_ FactoryDB_ GetConn

上海解封背后,这群开发者“云聚会”造了个AI抗疫机器人

Understanding recursion

Paw advanced user guide

【mysql进阶】索引分类及索引优化方案(五)

import torch_ Data view of geometric

Multi source BFS problem template (with questions)

编译安装基于fastcgi模式的多虚拟主机的wordpress和discuz的LAMP架构

D1 哪吒开发板 了解基本的启动加载流程

MySQL 查询 limit 1000,10 和 limit 10 速度一样快吗? 深度分页如何破解
随机推荐
Title: Yanghui triangle
Informatics Olympiad all in one 1000: introductory test questions
jsp跳转问题,不能显示数据库数据,并且不能跳转
A method of quickly creating test window
2062: [example 1.3] movie tickets
2068: [example 2.6] chicken and rabbit in the same cage
通过loganalyzer展示数据库中的日志
[brush title] probability of winning a draw
当字节跳动在美国输出中国式 996
Recursion of subviews of view
m1 pod install pod lint 失败解决方案
What if the MySQL installation on the apple computer is completed and cannot be found
Qt5 plug-in production
[Title brushing] Super washing machine
Talk about the top 10 classic MySQL errors
FFmpeg 学习指南
1414: [17noip popularization group] score
Paw advanced user guide
【mysql进阶】mysql索引数据结构的演变(四)
Codeforces 1637 C. Andrew and stones - simple thinking