摘要:
常量和指针(Pointers and Constants)——const 修饰的指针解惑一般遇到用const修饰的常量涉及到指针就会比较麻烦,容易把头搞晕,有个简单的技巧就是从右向左看,下面我举例子说明: const int* p1 = NULL; //写法一 int const* p2 = NULL; //写法二 int *const p3 = NULL; //写法三以下的赋值语句,被注释掉并加上“//error”提示的是错误写法,其他是正确的: p1 = NULL; p2 = NULL; // *p1 = 1;//error// *p2 = 2;//error// p3 = NULL; . 阅读全文
posted @ 2007-03-06 16:56
MXi4oyu
阅读(143)
评论(0)
推荐(0)

浙公网安备 33010602011771号