title: What does new char(size) mean in C++?
body: <p>While allocating a buffer via <code>new</code> (in C++) I mistakenly wrote:</p>
  
  <pre><code>int size = 1024 * 1024;
  char *buf = new char(size);
  </code></pre>
  
  <p>instead of the normal syntax</p>
  
  <pre><code>char *buf = new char[size];
  </code></pre>
  
  <p>However the code did get compiled and led to strange crashes when using this <code>buf</code> variable. Apparently it seems that a buffer of eight bytes was allocated.</p>
  
  <p>I would like to know the meaning of <code>new char(size)</code>.</p>