Types of arrays

Can somebody explain me the difference between:

1. int normalarray[] = {1,2,3,4,5};
2. std::vector<int> vec(5);
3. int* dynamic = new int[5];


?
don't forget std::array<int, 5> arr = {1,2,3,4,5};
@Cubbi thanks for your help but I don't understand your response. Can you make it more clear?

Thank you very much!
1. int normalarray[] = {1,2,3,4,5};
Defines array of int, of length 5, containing elements {1, 2, 3, 4, 5}.

2. std::vector<int> vec(5);
Defines an std::vector<int> object, containing elements {0, 0, 0, 0, 0}.

3. int* dynamic = new int[5];
Defines a pointer to int named dynamic and initializes it with the memory address of the chunk of memory allocated by new[]. That chunk of memory can hold 5 int's and currently holds garbage values.
So:
 
int normalarray[] = {0,0,0,0,0};
is the same as std::vector<int> vec(5);?
No it is not.
For one, vec knows its own length: std::cout << vec.size();
It can also resize (automatically), while normalarray can not resize at all (it will always hold exactly 5 elements).
Ok, thanks for your help..! :)
Topic archived. No new replies allowed.