把非const变量赋值给指向const的指针,改变变量,不报错?
#include<iostream>
using
namespace std;
int main()
{
int i =2;
const
int j=i;
const
int
*pic=&i;
int
*const cpi=&i;
//string *const pstring
while(i<11)
{
i++;
cout<<*pic<<endl;
cout<<*cpi<<endl; } system("pause");
return
0;
}
求解 |