奇怪的CONST,请大家试试下面的代码,给我个答案
俞庆平 2010-04-23 03:05:18 int _tmain(int argc, _TCHAR* argv[])
{
const int a = 5;
int * p;
p = (int *)&a;
cout << p << " " << &a << endl;
int b = *(&a);
*p = 4;
int c = *p;
int d = *(&a);
cout << p << " " << &a << endl;
cout << "b " << b << " c " << c << " d " << d << endl;
system ("pause");
return 0;
}
输出结果为:
0012FF60 0012FF60
0012FF60 0012FF60
b 5 c 4 d 5