0

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

3
  • Remove the ampersand & Commented Dec 4, 2013 at 6:55
  • 1
    @Pepe I revised my code, and you are correct. Thanks a lot. Commented Dec 4, 2013 at 7:19
  • There is no "pointer to array" here. You have an array of pointers. Commented Dec 4, 2013 at 9:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.