Variable subscripted array

Quick question, kinda. Can you make arrays without a set subscript. For example, let's say I wanna make a program that allows a user to enter all there employees, but you don't know how many employees they have. So you'd have to make the program with a variable subscript for the array. Is this possible, and if so, how do you do it, and then how do you manipulate/display it.
Yes, this is called a vector.

1
2
vector<Employee> employees;
employees.push_back(Employee(...));


With push_back you can add a new element at the end and size() gives you the number of elements in the vector. Element access works like with a fixed array.
See also: http://www.cplusplus.com/reference/stl/vector/
Ok I've heard about vectors but have not yet gotten there with my programming. What exactly are vectors?
They're dynamic arrays, there isn't much more to it. Read the reference above if you want any more details.
Last edited on
Topic archived. No new replies allowed.