Different array declaration

Hi,

I would like to know the difference between the following two forms of array declaration:

(1)double myArray[3] = {1.0, 2.0, 3.0};

(2)array<double,3> myArray = {1.0, 2.0, 3.0};

If I say the second one allows to use different functions like .begin(), am I right? Is there any other difference between these two declaration?

Thanks in advance.
They have different types. The first one is indeed an array. The second one is a template class that includes an array as its data member.
You mentioned already yourself that functionality of the second declaration is more rich than the first. Moreover it is compatible with the interfaces of other standard containers.
Last edited on
Thank you for your prompt reply.

Is there a difference in terms of size of memory occupation and speed of execution between these two?
The both occupy the same size in memory because the only data member of the template declaration is an ordinary array. And I do not see any difference in the speeds.
OK, thank you for the information!
Topic archived. No new replies allowed.