Okay... my goal is to start with an array of for instance 5 entries.
int myArray[5];
Then at some point once the array is passed to a function, change the number of entries (example: load a new list of something into the array that has a different number of entries) to for instance 9.
int myArray[9];
Simply doing the following does not seem to work because it returns a runtime error #2 about the stack around my array getting messed with:
myArray = new int[i_Count];
Also I tried another method of creating a new array in my function, filling it, then "delete" the old array and replace it with the new. This gave me an assertion error. example:
// initial declaration
int *myArray = new int[5];
// code of whatever
...
// in function array change
int myFunct(int *a_myArray)
{
// new array
int a_myArray2 = new int[9];
// random code for filling array
...
// delete old and create new
delete [] a_myArray;
a_myArray = a_myArray2;
}
I am stumped... my goal is to "in a function change the number of entries and values of an array from within a called function, which will not only when returning to the main procedure retains the changes, but also does not cause stack errors or assertion errors."
Thanks in advance. Insights would be appreciated.