当前位置:网站首页>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
边栏推荐
猜你喜欢
Fundamentals of music theory (brief introduction)
Open3d learning note 4 [surface reconstruction]
I'll show you why you don't need to log in every time you use Taobao, jd.com, etc?
[binocular vision] binocular stereo matching
Open3D学习笔记一【初窥门径,文件读取】
On the back door of deep learning model
Hystrix dashboard cannot find hystrix Stream solution
【DIoU】《Distance-IoU Loss:Faster and Better Learning for Bounding Box Regression》
【学习笔记】Matlab自编图像卷积函数
Using super ball embedding to enhance confrontation training
随机推荐
Specification for package drawing
STM32疑难杂症之ST-LINK Connection error INVALID ROM TABLE
【Batch】learning notes
Global and Chinese market of tillage finishing machines 2022-2028: Research Report on technology, participants, trends, market size and share
Open3D学习笔记一【初窥门径,文件读取】
【MagNet】《Progressive Semantic Segmentation》
Global and Chinese markets for Salmonella typhi nucleic acid detection kits 2022-2028: Research Report on technology, participants, trends, market size and share
解决jetson nano安装onnx错误(ERROR: Failed building wheel for onnx)总结
利用Transformer来进行目标检测和语义分割
利用超球嵌入来增强对抗训练
EKLAVYA -- 利用神经网络推断二进制文件中函数的参数
Dynamic extensible representation for category incremental learning -- der
Carsim-路面3D形状文件参数介绍
E-R draw clear content
Rhel7 operation level introduction and switching operation
力扣方法总结:查找类
【Sparse-to-Dense】《Sparse-to-Dense:Depth Prediction from Sparse Depth Samples and a Single Image》
jetson nano安装tensorflow踩坑记录(scipy1.4.1)
稀疏矩阵存储
Carsim-实时仿真的动画同步问题