title: c_str() vs std::string - what's the real difference in this piece of small code?
body: <p>Why does the code below print "NO"?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  void main()
  {
      const std::string abc = "hello";
  
      if (abc.c_str() == "hello")
      {
          cout &lt;&lt; "\nYES";
      }
      else
      {
          cout &lt;&lt; "NO";
      }
  }
  </code></pre>
  
  <p>The <code>.c_str()</code> returns <code>const char*</code> whereas <code>"hello"</code> should be interpreted as either <code>const char*</code> or <code>std::string</code>, both are valid. But why doesn't it print "YES". <code>strcmp()</code> does print "YES", when used instead. But my question is on the code above, is this a compiler bug?</p>