Array size without specifying?

I am doing a program that requires me to process employees pay.
Once the process is ended, the arrays are passed into a function and they are looped and printed on the screen as a report.

My problem is that i don't want to declare the arrays at a set size because the size should be based on how many employees are processed so setting a size may limit the user or not be efficient keeping all those memory locations if not needed.

The process is divided into functions and the information is stored just before the next employee is processed.

In other words, i would like the array size to be based on how many processes the user does rather then a set size.

Is there a method i can do this without having to set a size for the array?

Just looking for a point in the right direction.

Thanks!
Last edited on
Try out a vector. It's basically a dynamic array (which is what it seems you're asking for).

http://www.cplusplus.com/reference/stl/vector/

Topic archived. No new replies allowed.