I'm making an array of strings, with 100 elements. I created the array in my .h file:
const int N = 100;
typedef struct {
int size = 0;
string *list = new string[N];
} tStringList;
Then in my .cpp file, I implement the functions insert, search, remove and print for the array. But I don't know how to delete the element at the position pos of the array in the function remove. I tried this but it gives me error:
void remove(tStringList & stringList, int pos){
delete stringList.list[pos];
stringList.size--;
}
How do I delete a single element in a dynamic array?
pos + 1tillNto one previous position in the array.