const是一个C语言的关键字,它限定一个变量不允许被改变。

1)const在前面
const int nValue; //nValue是const
const char *pContent; //*pContent是const, pContent可变
const char* const pContent; //pContent和*pContent都是const
 
const只修饰其后的变量,至于const放在类型前还是类型后并没有区别。如:const int a和int const a都是修饰a为const
 
posted on 2013-05-30 00:07  h516077808  阅读(101)  评论(0)    收藏  举报