1.const char* p: p is a pointer to const char(char const* p 一样) 意思就是不能通过p指针来修改p指向的内容(但是内容可以修改). 2.char* p : p is a pointer to char 意思就是可通过p指针来修改p指向的内容 3.char* const p: p is a const pointer to char 意思就是p指针是一个常指针,他指向的内存地址不能变,定义的时候就得初始化 一旦给…
http://stackoverflow.com/questions/3228664/why-am-i-able-to-change-the-contents-of-const-char-ptr I passed a pointer ptr to a function whose prototype takes it as const. foo( const char *str ); Which according to my understanding means that it will n…