成都网站建设设计

将想法与焦点和您一起共享

const修饰指针

   int b = 10; 
int c = 15; 
const int *p1 = &b; 
//*p1 = 12; /* 错误 */
   p1 = &c; /* 正确*/
   cout<< *p1 << endl;

int * const p2 = &b; 
*p2 = c; /* 正确*/                                                                      
   //p2 = &c; /* 错误 */
   cout << *p2 << endl;

网页题目:const修饰指针
网站路径:http://chengdu.cdxwcx.cn/article/dsogode.html