const地址可以批改不
const地址可以修改不
在学习c语言深度剖析中,提到const int *p修饰的是*p,*p不可变;int * const p修饰的p,p不可变;可现在我ptr=&a,编译通不过去,
int a=123;
const int b=4;
const int* ptr=NULL;
int* p;
ptr=&a;/
为什么?
------解决方案--------------------
ptr = (const int *)&a;
这样可以编译过去了吧?
我直觉4楼赵老师的回复貌似不是同一个人在写
有些回复的风格很出位
嘻嘻
不知道是不是被我猜中了呢
在学习c语言深度剖析中,提到const int *p修饰的是*p,*p不可变;int * const p修饰的p,p不可变;可现在我ptr=&a,编译通不过去,
int a=123;
const int b=4;
const int* ptr=NULL;
int* p;
ptr=&a;/
为什么?
------解决方案--------------------
ptr = (const int *)&a;
这样可以编译过去了吧?
我直觉4楼赵老师的回复貌似不是同一个人在写
有些回复的风格很出位
嘻嘻
不知道是不是被我猜中了呢