c++指针常量和常量指针怎么记

指针常量: int * const p   按中文,"指针"二字在前,没有const 去修饰,所以int开头,那const肯定在后面修饰p,p可以理解为方向,就是该指针的方向不能变,值可以变

常量指针: const int * p  按中文,"常量"二字在前,所有const在前面修饰int,所以该指针的值不能变,那方向自然可以变

我自己的记忆方法

posted @ 2022-08-18 21:54  笨笨和呆呆  阅读(54)  评论(0)    收藏  举报