Arrays that can change size dynamically
I want to start making a sort of strategy game, where every 'unit' in the game will be stored in an array. I have a UNIT class that holds info on each unit.
What I want to do is to be able to re-size the array as each new unit is made. For example:
I hope you can understand what I mean. Really all I want is to learn how to create an array that can change its size.
// Game starts
UNIT * UnitArray[N] = new UNIT (with whatever we need to make 10 of them)
// A new unit is created
UnitArray[N+1] = new UNIT;