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++ > Initialization ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 44716 of 47995
Post > Topic >>

Initialization of vectors in c++

by pauldepstein@[EMAIL PROTECTED] Apr 13, 2008 at 08:15 AM

Experimenting at home with visual c++, I see that int main()
{std::vector<double> vect(5);}  creates a vector whose 5 initial
values are all 0.  Is this standard or might the five initial values
be different from 0?  I'm a bit surprised by this as I would expect
vect to consist of five uninitialized doubles.  Why is it that double
x; introduces a double which is uninitialized and yet the above vect
is initialized?  Or is this just a matter of the definition of the c++
language which should just be accepted, and can't be derived from some
other principle?

Thank you,

Paul Epstein
 




 4 Posts in Topic:
Initialization of vectors in c++
pauldepstein@[EMAIL PROTE  2008-04-13 08:15:31 
Re: Initialization of vectors in c++
Vladislav.Lazarenko@[EMAI  2008-04-13 08:33:49 
Re: Initialization of vectors in c++
Rolf Magnus <ramagnus@  2008-04-13 17:51:49 
Re: Initialization of vectors in c++
pauldepstein@[EMAIL PROTE  2008-04-13 08:42:21 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Sat Oct 11 21:22:32 CDT 2008.