A pointer question

This is a discussion on A pointer question within the C++ Programming forums, part of the General Programming Boards category; Let's assume that I have a pointer array like this one: Code: int **array = new int*[n]; should I use ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    100

    A pointer question

    Let's assume that I have a pointer array like this one:
    Code:
    int **array = new int*[n];
    should I use * in the delete operator or leave it out when releasing the allocated memory?
    I mean... which one of the following choices is the correct one:
    Code:
    delete[] *array; //or...
    delete[] array;

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,643
    The second one.

    gg

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    100
    Yeah, I realized that soon after posting (after the morning coffee finally kicked in)

    tyvm for the reply though
    Sauron a few seconds before his defeat:
    "What? A 'division by 0' error?!?"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting number
    By Leslie in forum C Programming
    Replies: 8
    Last Post: 05-20-2009, 04:23 AM
  2. Easy pointer question
    By Edo in forum C++ Programming
    Replies: 3
    Last Post: 01-19-2009, 09:54 AM
  3. char pointer to pointer question
    By Salt Shaker in forum C Programming
    Replies: 3
    Last Post: 01-10-2009, 10:59 AM
  4. Pointer question
    By rakan in forum C++ Programming
    Replies: 2
    Last Post: 11-19-2006, 01:23 AM
  5. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 08:32 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21