const int *p和int *const p快速区分

const int *p:其地址可变,内容不可变。个人记法为去掉int为const *p,const修饰*p,而*p又指其内容,所以内容不可变。

int * const p:其内容可变,地址不可变。个人记法为去掉int为*const p,const修饰p,p不可变则其地址不可变。

因为这两叫什么常量什么指针,我学起来十分具有迷惑性,所以不记名字,只记用途。

 

posted @ 2025-10-15 21:03  秋秋秋秋秋寒  阅读(4)  评论(0)    收藏  举报