-
Array Help
Ok I made a game which I want to store results of user input in a array and reads it later in the program except I have no idea how many time the user is going to use the game in one sitting so I have no way to make an array to acomidate this problem.
thanx
kas2002
-
a few suggestions.
1. linked list
2. std::vector
3. resize and copy your own dynamic array
4. use a file instead.
-
std::vector seems like the best option.
-
ummm....
I have no idea what std::vector is????
I would use a file but accessing a file many times in like3 4 seconds would be really slow though wouldn't it?
>>resize and copy your own dynamic array
is that overly hard? it sounds like my best option because I haven't much experince with linked lists.
-
pretty easy.
-fill in new pointer with new size
-memcpy the data from the old array to the new one
-fill in the new element
-delete the old array
-put the new array in the original pointer
bang! you've resized
-
nice