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;
}

const变量的修改实践

 

相关文章:

  • 2022-01-04
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
  • 2022-01-26
  • 2022-01-06
  • 2022-01-18
  • 2021-08-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2021-10-28
  • 2021-06-30
相关资源
相似解决方案