12.const

#include<iostream>
int main()
{
    double d = 3.14, f = 9.9;

    const double *i = &d;
    i = &f;  // 说明是底层const,可以更改i的值
    std::cout << *i << std::endl;

    const double *const a = &f;
    //a = &d;  //error

    system("pause");
    return 0;
}

代码从右向左看

猜你喜欢

转载自www.cnblogs.com/foremember/p/10485812.html