标题: 同一个地址可以存放两个值吗? [打印本页] 作者: maverick_zhang 时间: 2005-07-07 09:52 标题: 同一个地址可以存放两个值吗? const int value = 12345;
int *new_value = const_cast<int*>;(&value);
*new_value = 10;
cout<<"the address of value is"<<&value<<endl
<<"the newvalue is "<<new_value<<endl
<<"value = "<<value<<endl
<<"the content of newvalue is "<<*new_value<<endl;
我用DEV_C++编译,运行,结果是:
the address of value is 0x241ff5c
the newvalue is 0x241ff5c
value = 12345
the content of newvalue is 10