title: c++ what is "pointer = new type" as opposed to "pointer = new type []"?
body: <p>In many tutorials, the first code samples about dynamic memory start along the lines of:</p>
  
  <pre><code>int * pointer;
  pointer = new int;        // version 1
  //OR
  pointer = new int [20];    // version 2
  </code></pre>
  
  <p>They always proceed to explain how the second version works, but totally avoid talking about the first version.</p>
  
  <p>What I want to know is, what does <code>pointer = new int</code> create? What can I do with it? What does it mean? Every tutorial without fail will avoid talking about the first version entirely. All I've found out (through messing about) is this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
      int * pointer;
      pointer = new int;
     pointer[2] = 1932;   // pointer [2] exists? and i can  assign to it?!
     cout &lt;&lt; pointer[2] &lt;&lt; endl;      // ... and access it successfully?!
  };
  </code></pre>
  
  <p>The fact that I can subscript <code>pointer</code> tells me so far that <code>pointer = new int</code> implicitly creates an array. But if so, then what size is it?</p>
  
  <p>If someone could help clear this all up for me, I'd be grateful...</p>