How can one delete variable data at a certain point in the code?
Printable View
How can one delete variable data at a certain point in the code?
It depends on what one means by deleting variable data I suppose.
If you are trying to just save memory, then put the variable in a function(or in some other way that changes it's scope) along with the code that uses it.
If you are meaning to clear the data in it (this does not save space because the space for the variable is already reserved) then you can just set it to 0, or in the case of strings and char arrays "".
Or if the variable is allocated on the heap with new, delete it.