Original Post
Dynamic Memory: does increasing the size of a dynamic array delete stored values? Below is the whole story, if you care to help me out. If not, any sort of answer would be helpful. I'm in the process of learning C++ after learning C in full, and I've run into a snag. My current project is a simple baseball scorer, where the user inputs hits (single, double, triple, or homer) and the program translates successive hits into runs and totals each each team's score. Getting that to work was hardly a problem, and so I've tried to embellish the working program a bit by adding a few user-friendly additions, namely a 'recovery' function that, in theory at least, logs all user inputs and allows for corrections. With my limited knowledge, dynamic memory seems to be the perfect fit for such a logging system: set the array's size to a variable, and as needed increase the array's size to fit all the data put into the program. Toss in a few pointers to help with the correction process and voila! a correction process for any possible length of game. Before even adding the function to the program itself, I began fooling around with dynamic memory to see exactly how it works...and I'm stumped. The array is assigning seemingly random values that change each time the size of the array is increased. I've tried initiallizing each node manually, but the same problems keep coming up.