Thread: Crazy memory problem with arrays

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    The ARRAY is on the stack -- there isn't really a pointer to the array anywhere except temporarily when the array name is used by itself (if you want to look at it like that). Also, when you delete something, it doesn't matter where the pointer is stored, it's where the data pointed to is stored. The pointers usually ARE on the stack. But yeah, you must delete each element individually -- only use delete [] if the array itself is what's dynamically allocated.

    *Thinks about writing an article on arrays and pointers. A lot of people seem to have the same problem with the topic*
    Last edited by Polymorphic OOP; 01-14-2003 at 09:48 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  2. Assignment Operator, Memory and Scope
    By SevenThunders in forum C++ Programming
    Replies: 47
    Last Post: 03-31-2008, 06:22 AM
  3. Replies: 16
    Last Post: 01-01-2008, 04:07 PM
  4. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 01:57 AM
  5. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM