'Doubling dynamically allocated memory in a function using loops and conditions C++
So I need to add already existing films to a Listfilms function that allocates the films dynamically, and if there is no more space we have to double the allocated memory. How do I use pointers and "new" and "delete" methods in C++ please? And another - remove a film from the ListFilms without deleting it?
void ListFilms(string Films[],int nbElements, int* p){
for (int i=0; i<nbElements;i++){
if (Films[i]> *p){
}
}
This is basically my start but I know it is wrong. Can someone help me with this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
