C++ const int *pScore = &score的问题

#include "Program.h"
int main()
{
  
 int score=100;
 const int *pScore=&score;//不能通过*pScore更改score的数值,score = 400,pScore= &newValue还是可以的

 int newScore = 300;
 pScore=&newScore;

 //*pScore=300;
 score=200;
 cout<<score<<endl;//输出200;
 cout<<*pScore<<endl;//输出300;
 int result;
 cin>>result;
 return 0;
}

posted @ 2013-06-04 19:24  Predator  阅读(182)  评论(0编辑  收藏  举报