title: How do I grow and shrink a double-pointer dynamic array in C++?
body: <p>I'm learning C++ and I'm expected to use a double pointer to build a dynamic array of objects that grows and shrinks as elements are added and removes from the array. </p>
  
  <p>I can create the array like so:</p>
  
  <pre><code>Person** people = new Person*[10];
  </code></pre>
  
  <p>And add objects like so:</p>
  
  <pre><code>people[0] = new Person(“Luke”);
  people[1] = new Person(“Han”);
  people[2] = new Person(“Leia”);
  </code></pre>
  
  <p>And delete objects like so:</p>
  
  <pre><code>delete people[1]
  people[1] = null;
  </code></pre>
  
  <p>(At least I think that's correct.)</p>
  
  <p>But I'm stuck on several things...</p>
  
  <p>Questions:</p>
  
  <p>Once the array is full with 10 items, how do I dynamically add more space for additional objects?  In fact, I'm thinking the array should probably have a size of 0 before the first item is added; how do I do that?</p>
  
  <p>Similarly, when I delete an item (like when I delete people[1], above), how do I shrink the array down to a minimum size?  Like, how do I make the object at people[2] move to the position of people[1]?</p>
  
  <p>Any suggestions or help is greatly appreciated, thanks!</p>
  
  <p>rh</p>