"UnConsting" const value via pointer
<p>First, sorry for possible question redundancy.</p>

<p>Doing some little experiments with C/C++ pointers in GCC I encountered this somewhat weird behaviour when bypassing constantness of value at the pointer address.</p>

<pre><code>#include &lt;iostream&gt;
int main()
{
    using namespace std;

    const double number = 100;
//bypassing constantess of pointed-to value
    double * pointer_to_value = (double *) &amp;number;
    *pointer_to_value += 200;

    cout &lt;&lt; "Adress of number: " &lt;&lt; &amp;number &lt;&lt; "\tValue of number: " &lt;&lt; number &lt;&lt; endl &lt;&lt;
    "   Pointer value: " &lt;&lt; pointer_to_value &lt;&lt; "\tDereferencing pointer: " &lt;&lt; *pointer_to_value;

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

<p>I would expect both form of checking the value yielding same results. Location of value is same in both cases. Program generates following output, however:</p>

<p><em>Adress of number: 0x22ff30 Value of number: <strong>100</strong>
Pointer value: 0x22ff30 Dereferencing pointer: <strong>300</em></strong></p>

<p>Anyone capable of explaining?
Thanks in advance.</p>
