int* newArray = new int[newSize]; ... copying from old array ... int* temp = oldArray; oldArray = newArray; delete[] temp;