In the main I call a function as:
I know that I should always call delete when using new. But, in this scenario the x object would be destroyed automatically when the function gets out of scope. So, what if I do not call delete in the function? Does it hurt other than being a bad practice?Code:void test() { double* x = new double[10]; //----fill the array and print out stuff delete[] x; }




Reply With Quote