title: Unexpected output while using const_cast<>
body: <p>I have written below code my machine(devcpp) and codepad.org  but on my matching is working fine and on codepad.org(<a href="http://codepad.org/XfW5a8en" rel="nofollow">http://codepad.org/XfW5a8en</a>) the output is a garbage characters.</p>
  
  <blockquote>
  <pre><code>   #include &lt;iostream&gt;
      #include&lt;cstring&gt;
      using namespace std;
      int main () {
          char *str1 =const_cast&lt;char*&gt;(string("Hello ").c_str());
          char *str2 = const_cast&lt;char*&gt;(string("World!").c_str());
          char *ptr = str1;
          char *&amp;rptr = str1;
          rptr = str2;
          std::cout &lt;&lt; ptr &lt;&lt; str1 &lt;&lt; std::endl;
      }
  </code></pre>
  </blockquote>
  
  <p>I am expecting the output as
  Hello World!</p>