Are you not allowed to use the delete[] operator on an array that was dynamically allocated in a function with new?
e.g.,
I am confused about this. It seems to work in part of my code, but leads to segmentation faults in others.
e.g.,
Code:
void func1()
{
...
double *a;
func2(a);
delete[] a;
...
}
void func2(double *a)
{
...
a = new double[N];
...
}
I am confused about this. It seems to work in part of my code, but leads to segmentation faults in others.