title: Creating static array with a pointer?
body: <p>I know that arrays can be created on the stack with syntax such as <code>int array[5];</code> where the size must be known at compile time and <code>array</code> is a non modifiable l-value. </p>
  
  <p>You can also create an array dynamically on the heap with <code>new</code> such as <code>int* array = new int[5];</code> where it becomes possible to have a size of variable length and resize the array.</p>
  
  <p>But what about something like:</p>
  
  <pre><code>int* array;
  array[2] = 3;
  cout &lt;&lt; array[2] &lt;&lt; endl;
  </code></pre>
  
  <p>Which creates an array on the stack that appears to be resizable because I can continue adding elements. The only other thing that should be kept track of is the size. </p>
  
  <p>I wrote the above code accidentally in a project and I haven't seen it used ever. I not sure if it should be used at all, but I'm also not sure what's incorrect about it.</p>