No, the elements of va1 will be default constructed. I believe for a bool
this should mean it will be set to false. Your compiler may not implement
this correctly though.
>
> Can va1 be initialized like "valarray<bool> va1(10, false);" when defining
> it?

No, like this

valarray<bool> val(false, 10);
>
> Is it ok to assign va1 to va2?

Yes
> Does va2 have to be specified with a size
> before assigning va1 to it?

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!