I have a C++ program that dynamically allocates an array of integers. In the final function below I can't figure out how to allocate space for the array, new int[*arrPtr];
is what I had in mind after reading the chapter on pointers, and it compiles properly, but the program crashes. Could anyone take a look at my code and point me in the right direction?
I greatly appreciate any assistance on this matter, thank you very much for your time.
It's not
new int[*arrPtr]
It's
arrPtr = new int[num]; //num is the size of the array.