In C, I would have done it using realloc.
realloc
In C++, one would normally consider using the STL vector class.
vector
But how do I properly res
int* arr = new int[20]; ... //wanna resize to 25? int* temp = new int[25]; std::copy(arr, arr+20, temp); delete [] arr; arr = temp; ... //now arr has 25 elements
But, of course, you shouldn't do this :)