Thread: A pointer question

  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,981
    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, 10:54 AM
  3. char pointer to pointer question
    By Salt Shaker in forum C Programming
    Replies: 3
    Last Post: 01-10-2009, 11:59 AM
  4. Pointer question
    By rakan in forum C++ Programming
    Replies: 2
    Last Post: 11-19-2006, 02:23 AM
  5. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM