Question: how vector works internally in c++?
Answer: Vector is implemented as a dynamically allocated array. The memory for this array is allocated in the constructor. As more elements are inserted the array is dynamically increased in size. ... Another constructor with integer parameter creates an array of the specified size.