#include <iostream>
using namespace std;
int main()
{
int* pointer = new int[5];
pointer = new int [10];
delete[] pointer;
return 0;
}
After allocating new memory for the pointer, what happens to the old memory with the length of 5? If it is a memory leak, should I use realloc() instead?