常量指针新的理解

你可以通过修改地址间接修改指针指向的值
#include
using namespace std;

int main()
{
    int a = 10;
    int b = 20;
    const int * pLen = &b;
    int * const pNum = &a;
    //pNum = &b;
    pLen =&a;
    cout << *pLen << endl;
    *pNum = 22;
    cout << *pNum << endl;
    system("pause");
}

你可能感兴趣的:(常量指针新的理解)