Closed ferdymercury closed 4 years ago
I think when one calls
x = new int[N]
then in the destructor it should say delete[] x; with the square brackets.
delete[] x;
See http://www.cplusplus.com/reference/new/operator%20delete[]/
See also http://www.cplusplus.com/forum/general/36130/
Thanks! Yes, memory of array should be released in with the square brackets!
I think when one calls
x = new int[N]
then in the destructor it should say
delete[] x;
with the square brackets.See http://www.cplusplus.com/reference/new/operator%20delete[]/