const char* const a

来源:互联网 发布:淘宝卖东西要交押金吗 编辑:程序博客网 时间:2024/05/06 01:28
char * const a;

means that the pointer is constant and immutable but the pointed data is not.
You could use const_cast(in C++) or c-style cast to cast away the constness in this case as data itself is not constant.

const char * a;

means that the pointed data is constant and immutable but the pointer is not.
Using a const_cast(C++) or c-style cast to cast away the constness in this case causes Undefined Behavior.


0 0
原创粉丝点击