经常容易混淆的概念
pointer to const -> 指向的数据不能被修改
const pointer -> 指针的地址不能被修改
int a = 3; int b = 4; // read from right to left const int * p1 = &a; // a pointer to a const int int * const p2 = &b; // a const pointer to an int *p1 = b; // not OK p1 = &b; // OK a = 4; // OK: *p1 = 4 p2 = &a; // not OK *p2 = a; // OK
reference: http://www.cnblogs.com/haox/p/3177726.html