declaring arrays with visual C++ toolkit 2003

This is a discussion on declaring arrays with visual C++ toolkit 2003 within the C++ Programming forums, part of the General Programming Boards category; so I put: delete[] verts1; and it still alows me to use verts1 in other functions. I don't think that ...

  1. #16
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    so I put:

    delete[] verts1;

    and it still alows me to use verts1 in other functions. I don't think that is working.

  2. #17
    Registered User
    Join Date
    Jan 2005
    Posts
    7,318
    Yes, it should be delete [] verts instead of delete verts.

    If you call delete [], and then use the pointer elsewhere, it might work, or it might not. That is undefined behavior. It will usually cause your program to crash. The point is you must make sure that you don't use verts after you delete [] it.

  3. #18
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    so basicly just delete it in the clean up process. ok I'll do that.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 09:43 AM
  2. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 07:13 PM
  3. Using 'if' with char arrays or string objects
    By c++_n00b in forum C++ Programming
    Replies: 36
    Last Post: 06-06-2002, 09:04 PM
  4. odd errors from msvc std library files
    By blight2c in forum C++ Programming
    Replies: 6
    Last Post: 04-30-2002, 12:06 AM
  5. <list>
    By Unregistered in forum C++ Programming
    Replies: 9
    Last Post: 02-24-2002, 03:07 PM

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