Dynamic array that can be re-sized at runtime

hi

how can I create a dynamic array that can be re-sized at run time.

The code below is part of a while loop that has to add new data when its found but the problem I'm having is that its resetting all the array's elements after every cycle. And I'm thinking the new declaration might be the result.

any advice of adding stuff within my loop.

plus I'm also having trouble deleting the run time arrays afterwards,,
1
2
3
4
5
6
7
	if (sGetInput == "O3")
{
	adThirdOrbit = new double[ielemnts3];
			FI_ZumaLv1 >> adThirdOrbit[ielemnts3];
			ielemnts3++;
			FI_ZumaLv1 >> adThirdOrbit[ielemnts3];
			ielemnts3++;


...
/*assertion error is here, but maybe its due to the error in the dynamic array above*/
delete[] adThirdOrbit; //store third orbit in array
}
This is the same question as http://www.cplusplus.com/forum/beginner/53747/

Please add new responses to the other thread.

Andy
Topic archived. No new replies allowed.