当前位置:网站首页>Constant pointer and pointer constant
Constant pointer and pointer constant
2022-07-02 08:07:00 【programmercherry】
Detailed explanation of the difference between constant pointer and pointer constant
* ( The pointer ) and const ( Constant ) Read who is first ;
* Symbolic pointer ,const Symbolic content ;
No one is allowed to change who is in front
1. Constant pointer
int a = 10;
int b = 20;
const int* p = &a; //const before , Defined as a constant pointer
p = &b; // correct , The direction of the pointer can be changed
//*p = 20; // error , The value pointed by the pointer cannot be changed
characteristic : Pointer pointing ( Address to ) You can modify , But the value the pointer points to cannot be changed
( Content cannot be reassigned , The content can be changed by changing the address to point to the post transformation )
Constant pointers are essentially pointers , Constant modifies it , Indicates that this pointer is a pointer to a constant ( Variable ). The object that the pointer points to is a constant , Then this object cannot be changed .
2. constant pointer
int a = 10;
int b = 20;
int* const p = &a; //* before , Defined as a pointer constant
*p = 20; // correct , The value the pointer points to can be changed
//p = &b; // error , The pointer cannot be changed
characteristic : Pointer pointing ( Address to ) Cannot be modified , The value the pointer points to can be modified .
Must be initialized , Address follows life .
The nature of a pointer constant is a constant , And use pointers to decorate it , So the value of this constant should be a pointer
Expand :
this The essence of a pointer is constant pointer The point of the pointer cannot be changed
边栏推荐
- 多站点高可用部署
- Summary of solving the Jetson nano installation onnx error (error: failed building wheel for onnx)
- 将恶意软件嵌入到神经网络中
- Target detection for long tail distribution -- balanced group softmax
- Open3d learning notes II [file reading and writing]
- 【Hide-and-Seek】《Hide-and-Seek: A Data Augmentation Technique for Weakly-Supervised Localization xxx》
- STL速查手册
- 用于类别增量学习的动态可扩展表征 -- DER
- C#与MySQL数据库连接
- 浅谈深度学习中的对抗样本及其生成方法
猜你喜欢
Replace convolution with full connection layer -- repmlp
Where do you find the materials for those articles that have read 10000?
Command line is too long
[learning notes] numerical differentiation of back error propagation
Carsim-实时仿真的动画同步问题
[binocular vision] binocular correction
使用Matplotlib绘制图表初步
Principes fondamentaux de la théorie musicale (brève introduction)
【Random Erasing】《Random Erasing Data Augmentation》
用全连接层替代掉卷积 -- RepMLP
随机推荐
Erase method in string
I'll show you why you don't need to log in every time you use Taobao, jd.com, etc?
SQLyog远程连接centos7系统下的MySQL数据库
Dynamic extensible representation for category incremental learning -- der
On the confrontation samples and their generation methods in deep learning
Go functions make, slice, append
【FastDepth】《FastDepth:Fast Monocular Depth Estimation on Embedded Systems》
针对tqdm和print的顺序问题
Cvpr19 deep stacked hierarchical multi patch network for image deblurring paper reproduction
Open3d learning notes II [file reading and writing]
open3d学习笔记三【采样与体素化】
使用C#语言来进行json串的接收
Real world anti sample attack against semantic segmentation
【C#笔记】winform中保存DataGridView中的数据为Excel和CSV
静态库和动态库
简易打包工具的安装与使用
Organigramme des activités
Nacos service registration in the interface
[binocular vision] binocular correction
力扣每日一题刷题总结:二叉树篇(持续更新)