How can one delete variable data at a certain point in the code?
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.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.