const指针总结

const 总结:
假设keywordconst出如今星号左边。表示被指物是常量;即不能通过指针改动变量的值。


假设keywordconst出如今星号右边,表示指针自身是常量;即不能改变指针的指向。

假设被指物是常量,会有两种形式:

int a=3,b=4;

const int* p=&a;

int const *p=&a;

这两种形式等效。

详细举例见:const指针
posted @ 2017-06-07 10:42  llguanli  阅读(102)  评论(0编辑  收藏  举报