George Exarchakos wrote:
this is, I guess, very easy question but I cannot find a specific well
documented answer.
When I use:
int *x = new int(8);
it obviously allocates memory for a new int. But do I have to
explicitly deallocate (delete) it as with any object dynamically
created with 'new'?
Nah... If you don't care about memory leaks, that is.
Objects created by means of 'new' operator [in free store] live until
they are removed from free store by means of 'delete' operator. So,
if you don't delete your 'int', it will keep on living, just like any
other object. There is no difference between a built-in type and any
of UDTs you can think of.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask