关于const的一点小花招

来源:互联网 发布:万方数据库英文怎么写 编辑:程序博客网 时间:2024/04/28 19:06
const int num = 0;const int *p = #//指向const类型的指针,指针值可以变int num2 = 0;int *const cp = &num2;//const指针,指针所指向的变量的值可以变const int *const cpp = #//指针是不变的,指针所指向的变量的值也是不能变的...typedef string* pstring;const pstring strpc = NULL;//这个实际上是常量指针,相当于string *const strpc;const int *cpArr = new int[10]();//数组中每个元素都是const int 类型


原创粉丝点击