Quote:
Originally posted by PaulWendt
Despite what one of the other posters above said, don't remove the square brackets on the delete statement. When you're allocating an array, you must call delete [] and not delete. I can never remember the exact reason and I'm sure I'll be corrected, but I seem to remember that if you leave off the [], the destructor for ONLY the first item in the array will get called.
--Paul
The only reason is that using delete on something allocated with operator new [] (and vice-versa) leads to undefined behavior. What the behavior is, is up to the compiler. It could do a whole host of things from working flawlessly, to crashing your program. Therefore you never mix them up: