copying data from pointer-to-array to pointer-to-array

34 views Asked by At

How would I go about copying the content of a pointer to an array to a temporary pointer to an array, and then making the original pointer point to the same thing the temporary pointer is pointing too? In code form, :

bankAccount **array = new bankAccount* [maxSize];
bankAccount **temp = new bankAccount* [maxSize + 5];

for(int i = 0; i < maxSize; i++)
{
    temp[i] = &array[i]
}

delete [] array;
array = temp;

When I compile the code above, I get the error:

assigning to bankAccount * from incompatible type bankAccount **; remove

0

There are 0 answers