What does int* resizeArray do that int resizeArray doesn't, what' the deference?
And why do I delete nArray, and not newArray?
#include <iostream>
using namespace std;
void printArray(int* nArray,int size)
{
// code printing array
}
int* resizeArray(int* nArray, int oldsize, int newsize )
{
int* newArray = new int[newsize];
// code copying old to new...
delete[] nArray; // <--- Why not new array
return newArray;
}
int main()
{
int* nArray = 0;
//code...
delete[] nArray;
nArray =0;
}