September 2nd, 2003, 11:30 PM
Resizing a global array in C++
Question: In C++, what is the best way (if any) to have a function resize a global integer array that has already been declared?
Here is the whole story if you care to hear it. I need to declare an integer array globally at the beginning of the program, but, later in the program, the user needs to enter a number that will re-define the size of the array.
September 2nd, 2003, 11:52 PM
Try declaring a pointer variable then and resize it using new and delete. Another alternative would be to use the STL vector class instead. Check this forum or google for lots of examples
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
September 3rd, 2003, 12:28 AM
Thank You Very Much
Oh, thank you thank you thank you! I completeley forgot about vectors! (Its been a while since computer science I) That should work very nicely. Thank you!