By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,260 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,260 IT Pros & Developers. It's quick & easy.

Do I need delete or delete [] here...

P: n/a
int* integers = new int[10];

delete integers;
Jul 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Wed, 10 Dec 2003 15:23:36 +0000, 0to60 wrote:
int* integers = new int[10];

delete integers;


deltete [] integers; you create an array, you delete an array :>
Jul 22 '05 #2

P: n/a
"0to60" <ho****************@yahoo.com> wrote in news:YTGBb.35582$uG1.4236
@newssvr32.news.prodigy.com:
int* integers = new int[10];

delete integers;


Yes. Allocate with new[]? Deallocate with delete[].
Jul 22 '05 #3

P: n/a
0to60 <ho****************@yahoo.com> wrote:
int* integers = new int[10];

delete integers;


should be:

delete []integers;
--
== Eric Gorr ========= http://www.ericgorr.net ========= ICQ:9293199 ===
"Therefore the considerations of the intelligent always include both
benefit and harm." - Sun Tzu
== Insults, like violence, are the last refuge of the incompetent... ===
Jul 22 '05 #4

P: n/a
In article <YT******************@newssvr32.news.prodigy.com >, holeshot60
_n******@yahoo.com says...
int* integers = new int[10];

delete integers;


What you should probably use is:

std::vector<int> integers(10);

with no delete needed. Roughly 95% of the time that people use new,
it's neither necessary nor desirable.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jul 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.