POV-Ray : Newsgroups : povray.off-topic : c++ memory question : Re: c++ memory question Server Time
11 Oct 2024 11:11:00 EDT (-0400)
  Re: c++ memory question  
From: Warp
Date: 2 Oct 2007 18:49:47
Message: <4702cb0b@news.povray.org>
Samuel Benge <stb### [at] thishotmailcom> wrote:
> It's probably a stupid question, but here goes. I know that for every 
> "new", there must be a delete.

> 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?

  Odd question, given that you answered it even before you asked it.

  If you deleted it, you would have more deletes than news, which would
break the "for each new, delete" rule.

> I didn't use a "new" flag to initialize the array. Is the 
> memory used by that array freed after the program is terminated?

  No. It's freed when it goes out of scope.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.