In the C, const 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
中禁止被修改。
实际使用中设计指针时比较复杂。
In the C, const 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
中禁止被修改。
实际使用中设计指针时比较复杂。