In the Cconst is a type qualifier,  a keyword applied to a data type that indicates that the data is read only. 

简单的例子:

  • char const foo = 'a';

变量foo不允许被修改,

  • void Foo(int const a[]);

数组a在函数Foo中禁止被修改。

 

实际使用中设计指针时比较复杂。

https://en.wikipedia.org/wiki/Const_(computer_programming)

You have no rights to post comments