Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • The second example is wrong. "new Character[MAX_CHARACTERS]" creates an array of Character objects, but then you go through and manually create an array of Character objects, overwriting (and leaking) the first ones. "delete [] characters" will try probably crash since it's deleting an array of already-deleted objects. Commented Aug 28, 2009 at 20:08
  • 1
    Never mind my comment - there was a typo in the example. It should have been "new Character *[MAX_CHARACTERS]", which is allocating an array of pointers, not an array of objects. I fixed the example and removed my downvote. :-) Commented Aug 28, 2009 at 20:20
  • Ah, thanks! I was writing in a hurry, and didn't proofread as well as I should have. Commented Aug 28, 2009 at 21:29