I am in Programming Fundamentals 3 at a college and I need help debugging my program. I have been trying to for 12 hours now and I would love any help. Thank you so much!
Roughly, an approach could look like this:
Dynamically allocate an array of size C. We'll call C the "capacity" of the array.
Keep track of an integer named S, which stands for the "size" of the array. Let S contain the value 0.
Each time a value needs to be added to your array, write it at index S, and increment S.
If and only if S is equal to C, allocate a new array with size C * 2. Then, copy the elements from the old array to the new array, and deallocate the old array.
This is basically the idea behind dynamic containers like std::vector.