#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
const int n = 100;//后面使用n的值的地方会直接用100代替
volatile const int m = 200;//m随时可能改变,每次从内存重新取
int *p = (int*)&n;
*p = 123;
cout<<n<<endl;
p = (int*)&m;
*p = 456;
cout<<m<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main()
{
const int n = 100;//后面使用n的值的地方会直接用100代替
volatile const int m = 200;//m随时可能改变,每次从内存重新取
int *p = (int*)&n;
*p = 123;
cout<<n<<endl;
p = (int*)&m;
*p = 456;
cout<<m<<endl;
return 0;
}