C++ Pointer Confusion
<p>Please Explain the following code</p>

<pre><code>#include &lt;iostream&gt;

using namespace std;

int main()
{
    const int x = 10;
    int * ptr;
    ptr = (int *)( &amp;x );    //make the pointer to constant int*
    *ptr = 8;               //change the value of the constant using the pointer.
    //here is the real surprising part
    cout&lt;&lt;"x: "&lt;&lt;x&lt;&lt;endl;          //prints 10, means value is not changed
    cout&lt;&lt;"*ptr: "&lt;&lt;*ptr&lt;&lt;endl;    //prints 8, means value is changed
    cout&lt;&lt;"ptr: "&lt;&lt;(int)ptr&lt;&lt;endl; //prints some address lets say 0xfadc02
    cout&lt;&lt;"&amp;x: "&lt;&lt;(int)&amp;x&lt;&lt;endl;   //prints the same address, i.e. 0xfadc02
    //This means that x resides at the same location ptr points to yet 
    //two different values are printed, I cant understand this.

    return 0;
}
</code></pre>
