Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C - C++ Learning > Question about ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 12 Topic 4247 of 4370
Post > Topic >>

Question about array declaration

by Pat <pkelecy@[EMAIL PROTECTED] > Aug 25, 2008 at 08:11 AM

What's the difference between

(A)	double * x = new double [10];

and

(B)	double x[10];

?

I ask because I'm modifying some C++ code someone else wrote, and they 
tend to use (A), but I've found (B) works just as well (and is a little 
clearer imo).  But I suspect there there must to difference, otherwise 
why have both.

Also, can

	delete [] x;

be use to free up memory created with (B)?

Thanks for any explanations.  -Pat
 




 12 Posts in Topic:
Question about array declaration
Pat <pkelecy@[EMAIL PR  2008-08-25 08:11:41 
Re: Question about array declaration
Richard Heathfield <rj  2008-08-25 12:25:10 
Re: Question about array declaration
Pat <pkelecy@[EMAIL PR  2008-08-26 08:08:17 
Re: Question about array declaration
Francis Glassborow <fr  2008-08-26 13:59:41 
Re: Question about array declaration
Richard Heathfield <rj  2008-08-26 15:12:38 
Re: Question about array declaration
Barry Schwarz <schwarz  2008-08-25 09:39:04 
Re: Question about array declaration
Pat <pkelecy@[EMAIL PR  2008-08-26 08:33:36 
Re: Question about array declaration
Bart van Ingen Schenau &l  2008-08-26 19:06:50 
Re: Question about array declaration
Francis Glassborow <fr  2008-08-26 13:24:39 
Re: Question about array declaration
Jonathan Campbell <jg.  2008-08-26 16:40:01 
Re: Question about array declaration
Pat <pkelecy@[EMAIL PR  2008-08-27 20:55:33 
Re: Question about array declaration
Barry Schwarz <schwarz  2008-08-26 17:01:42 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 8:40:19 CST 2008.