title: Why do I get an exception when I pass a std::string to printf?
body: <pre><code>#include&lt;iostream&gt;
  #include&lt;string.h&gt;
  #include&lt;stdio.h&gt;
  
  using namespace std;
  
  int main()
  {
      char a[10] = "asd asd";
      char b[10] ="bsd bsd";
      string str(a);
      str.append(b);
      printf("\n--------%s--------\n", str);
      return 0;
  }
  </code></pre>
  
  <p>I can't understand why this produces an exception? This program mainly tries to append strings. I get the desired output when using <code>std::cout</code> but not when using <code>printf</code>.</p>