varying size array
I have a program that I'm looping quite a few times, every time it loops it produces some relevant data that I want to keep track off, however that number of points (data) that are produced varys with each iteration of the loop, my question is :
is there a way to declare a varying size array that will only be as big as it needs to be. I'm running 256 experiments, and during each iteration(expriment), there may be 5 points produced or none, or 10...but I don't want to just declare an encompassing arrary of size  or so, and not even use most of it for each iteration (experiement)...
I'm using the complier: codewarrior... and tried having a counter to keep track of the number of points of data produced then inserting them into an array, where the size is what was produced by the counter...so that no space in the array is wasted... am I using a wrong approach?? is this not possible?? thanks much for any help...
Much better if you used a linked list
Or if you've got the C++ STL with your compiler, consider an expanding structure like <vector>
thanks...I've not really used vectors much...could you give perhaps an exmaple of how vectors can be declared so that they can be of varying size... thanks much...
and there is a resize function on it so that you can check the size and resize when necessary. have fun
you could use dynamic memory as well, but then you have to worry about memory leaks if the program crashes and doesn't get a chance to run the delete command, or if you forget to put in a delete command.
pDynamic = new int
delete  pDynamic;