What do you need to do to clean up an int or char (not a pointer)?
Is it necessary to clean up this type of data after use?
sample ex:
// MAX = 100 ;
class Simple {
int a[ MAX ] ;
public :
~Simple ( ) ;
... // some declaration to fill, initialize ...
};
Is it essential to clean up data on the stack, e.g. the array a[ MAX ] in the example?
You don’t have to overwrite
intorchararrays unless you really care that data store in them can be somehow used to obtain sensitive data like passwords from your program.See this and this questions for details on when that is needed. You likely don’t need to worry about that.
But don’t confuse overwriting memory with allocating memory. If you used
newto allocate an instance of yourclass Simplebe sure to usedeleteto deallocate the instance at some moment, otherwise you have a memory leak.