Hi all,
if I create a funtion Array2(int,int) which return a matrix and that inside the function I create the array using the NEW operator, do I need to use the DELETE operator to delete the matrix after use?
it should be stated that you have to be careful with your delete calls. they are very necessary but can get a bit tricky. say you pass a pointer to another function, then you delete the object in the original, but it's still needed in the secondary function. you'll get a memory exception. that's a simple multi threaded example. just be careful, but as zyrenthian said, every new should be accompanied by a delete somewhere down the road(even if you dont' call the delete. eg. you use a container class like a CList and you delete the CList or it goes out of scope.. the CList's destructor should call the destructor on all of it's members, and subsequently you wouldn't need to call delete. I'm pretty sure about that, but if not could someone clarify for me?) good luck MYenigmaSELF:-9
myenigmaself@yahoo.com
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.