https://bbs.csdn.net/topics/110049293

#include <iostream>

using namespace std;

int main(){

    cout << "const变量实践:" << endl;


    // 必须加 volatile才会改变
    const volatile int a111 = 1;

    *((int*)&a111) = 22222;
    cout<<a111<< endl;;

    cout << "a111:" << a111 << endl;

    register int b = 2;

    cout << "b:" << b << endl;

    int *p1 = (int*)&a111;
    cout << "*p11:" << *p1 << endl;

    int *p2 = &b;
    cout << "*p2:" << *p2 << endl;

    cout << "end." << endl;
    return 0;
}

 

posted on 2019-07-05 20:27  大辉_FFf  阅读(223)  评论(0编辑  收藏  举报