I have a question that has been in the back of my mind for a while now and up to now I have assumed that the objects are destroyed after the function call but this is the question I have.
If I have a method that returns a pointer such as
WORD* MyWrdPtr = new WORD ;
WORD* MyOtherWrdPtr = new WORD ;
WORD* w_res = new WORD ;
// Do something and then
Do I need to delete the other two WORD pointers or are they automatically
Nothing is freed automatically. For every new, there must be a delete.
Ofc you should delete them.
memory allocated on the heap has to be "freed" by the programmer.
Thanks for clearing that one for me !