|
|
> Hi,
>
> It's probably a stupid question, but here goes. I know that for every
> "new", there must be a delete. I don't deal with malloc statements, so
> let's disregard that branch of memory management.
>
> So here's the question. If I create an array like so: int i[20];, and
> then proceed to assign values for each entry, must I then delete it at
> some point? I didn't use a new flag. Is the memory used by that array
> freed after the program is terminated?
>
What you make whith the instruction int i[20]; is a static array, that
is allocated in the stack if I remember correctly. You do not have to
manage the memory in the stack, so no free or delete.
Try googling for "static dynamic array C++", it should bring you
something useful...
Hope this helps
--
Vincent
Post a reply to this message
|
|