title: Copy array then delete original
body: <p>I have an array of a structure (with the parameters of name and number), and the initial array takes in elements from a document that I've made. The initial list size starts at 1000. When the list fills up, I call another method that I'm struggling with. I would like for it to copy the data into a new array that doubled the size, and then delete the old array.</p>
  
  <p>If I name it: array1 and array2, I have my program use array1 throughout. I need help with the pointers that would get array2 to work as array1.</p>
  
  <p>Is there a way to copy the array to a temp array of the same or new size, and then remake the initial array reassigning back to that? For this exercise, I can't use vectors. While I know how to use them, and that they solve this issue while being better, I'm trying to do it with only arrays.</p>
  
  <pre><code>using namespace std;
  
  struct Information {
    char functionality;
    int SSN;
    string name;
  };
  
  int numPeople = 1000;
  
  //Gets called if the initial array (whatever size) is filled
  void doubleArray(Information *array){
    numPeople = numPeople * 2;
    //Will now be the doubled array size
    Information temp[numPeople]
    for(int i = 0; i &lt; numArray; i++){
      temp[i].SSN = array[i].SSN;
      temp[i].name = array[i].name;
    }
    //Normally makes it crash
    delete[] array;
  }
  </code></pre>
  
  <p>edit: This is what I currently have</p>
  
  <pre><code>void doubleArray(Information *person){
    numPeople = numPeople * 2;
    Information* temp = new Information[numPeople];
    memcpy(temp, person, numPeople);
    delete[] person;
    person = temp;
  }
  </code></pre>
  
  <p>It gets to numPeople = 1000 (the initial list size) but then crashes shortly after. Is the doubling array correct?</p>