Hey I need a way to check if a Dynamic Array is full. I am writing a check program for class saying once an array is full I have a function that creates a new array (doubled in size) and moves all the elements into it. I was able to create it, but I want to create an if/else statement that tells the program when to call the doubleArray function. Any ideas?
so I can say something like, when i = size (where size is the amount of elements in the array) call the doubleArray function? Is it really that simple? haha thanks!
Turn your array into a container? Put it inside a class, alongside a size_t variable that stores its size, and write overloaded operators that let you treat it as a normal array, but automatically check and re-allocate memory if needed (or just use an existing container).