#include using namespace std; /* * For those of you who remember that previously we used * static_cast to cast a double to an int, here, the * compiler will not even let us do this: we must state * that we want to *reinterpret* the pointer to a double * as a pointer to an integer. * * Most of you will never see reinterpret_cast again for * the rest of your happy lives. Be happy. :-) */ int main() { double x = 3.141592653589793; // force it to store the address of x in a variable // declared to be a pointer to an integer int * int_ptr = reinterpret_cast( &x ); cout << "The double 'x' has the value " << x << endl; *int_ptr = 314159265; cout << "The double 'x' now has the value " << x << endl; return 0; }