Here's the code, I'm getting a run-time error and I'm very confused.
int* reversearray(int *a, int sz){
int* array = new int[sz];
for(int i = 0 ; i < sz; ++i){
array[i] = a[i];
}
delete [] a;
a = NULL;
return array;
}
int main() {
int size = 5;
int hello[size] = {1 , 2, 3, 4 ,5};
int* p = hello;
int* q = reversearray(p, size);
return 0;
}