求推荐最好的track device & anti-theft 的app# PDA - 掌中宝
w*g
1 楼
运行一下 程序:
int main() {
const int i = 0;
int * j;
cout << "&j=" << &j << endl;
cout << "&i=" << &i << endl;
cout << "j=" << j << endl;
j = const_cast(&i);
*j = 2;
cout << "i=" << i << endl;
cout << "*j=" << *j << endl;
cout << "j=" << j << endl;
cout << "&i=" <}
得到结果:
&j=0xbf93a658
&i=0xbf93a65c
j=0
i=0
*j=2
j=0xbf93a65c
&i=0xbf93a65c
这就是说:j 和&i是一样的,但是为什么i和*j不一样呢?
int main() {
const int i = 0;
int * j;
cout << "&j=" << &j << endl;
cout << "&i=" << &i << endl;
cout << "j=" << j << endl;
j = const_cast
*j = 2;
cout << "i=" << i << endl;
cout << "*j=" << *j << endl;
cout << "j=" << j << endl;
cout << "&i=" <}
得到结果:
&j=0xbf93a658
&i=0xbf93a65c
j=0
i=0
*j=2
j=0xbf93a65c
&i=0xbf93a65c
这就是说:j 和&i是一样的,但是为什么i和*j不一样呢?