#include <iostream>
using namespace std;
//指针
if (1)
{
int a = 10;
int b = 20;
const int* pi = &a;
pi = &b; //const指针可以修改指针,不能修改指向的数据
//*pi = 25; //错误 表达式必须是可修改的左值
cout << *pi << endl;
}
#include <iostream>
using namespace std;
//指针
if (1)
{
int a = 10;
int b = 20;
const int* pi = &a;
pi = &b; //const指针可以修改指针,不能修改指向的数据
//*pi = 25; //错误 表达式必须是可修改的左值
cout << *pi << endl;
}