#include
using namespace std;
void foo(const int a)
{
int *p = const_cast<int>(a);
*p = 10;
cout << *a << endl; //输出10
cout << a << endl;
}
int main()
{
const int n = 100;
foo(&n);
cout << n << endl; //输出100
cout << &n << endl;//&n和foo函数中的a的值是相等的,但是对一个地址取内容为什么会不同呢?
cout << (&n) << endl; // 输出100
int *x = (int)&n;
cout << *x << endl; //输出10 为什么?
return 0;
}