其实只要注意从右向左读取,这样就很好识别了
可以参考下这关于const的faq
举个例子 const * int p 有些时候会忽悠进int const * 和 int *const之类的当中来迷惑
You have to read pointer declarations right-to-left.
- Fred const* p means "p points to a constant Fred": the Fred object can't be changed via p.
- Fred* const p means "p is a const pointer to a Fred": you can't change the pointer p, but you can change the Fred object via p.
- Fred const* const p means "p is a constant pointer to a constant Fred": you can't change the pointer p itself, nor can you change the Fred object via p.