In one function. I create a local arrray. char arr[20];
And before end of this function.
Will compiler do garbage collection for me? Or I need to do delete by myself?
In one function. I create a local arrray. char arr[20]; And before end of
Share
There is no Garbage Collection in C++.
However, if you use automatic variables, they will be destroyed when they fall out of scope.
As a rule, there should be 1
deletecall for everynew. If you have nonew, you don’tdelete.