array reallocation C++
<p>Suppose you have an array, items, with capacity 5 and suppose also you have a count varaible that counts each entry added to the array. How would you realloacte the array? Using C++ syntax?</p>

<pre><code>void BST::reallocate()
{
    item *new_array = new item[size*2]; 
 for ( int array_index = 0; array_index &lt; size * 2; array_index++ ) 
    {
        if ( ! items[array_index].empty )
        {
   new_array[array_index].theData = items[array_index].theData;
   new_array[array_index].empty = false;
  }
    }
    maxSize += size;
    delete [] items;

    items = NULL;
    items = new_array;
 }
</code></pre>

<p>How do you reallocate an array?
BST ctor is below with the private items struct, just to eliminate any confusion. </p>

<pre><code>BST::BST(int capacity) : items(new item[capacity]), Position(0), 
leftChild(0), rightChild(0), maxSize(capacity)
{

}
</code></pre>

<p>this is in the BST header:</p>

<pre><code>private:
 int size;
 int maxSize;
 int Position;
 int leftChild;
 int rightChild;
 struct item
 {
  bool empty;
  data    theData;

 };

 item *items;
</code></pre>

<p>The quesetion is that i seem to be having a hard time with the reallocation of my items array.</p>
