title: Dynamically allocating memory for changing array size starting with unknown size C++
body: <p>How do I dynamically allocate an array where the size will be changing because the stuff stored in the array will be read from a file. There are lots of suggestions on using a vector, but I want to know how to do it the array way.</p>
  
  <p>I know for memory allocation it is </p>
  
  <pre><code>int count;
  int *n = new int[count];
  </code></pre>
  
  <p>Say the variable count is going to increment in a loop. How would I change the size of the array? </p>
  
  <p>Also, what if we did it using malloc?</p>