c++ functions dynamic vector code example
Example: c++ functions dynamic vector
void FreeMemory(string *&v) {
if (v != nullptr) {
delete[] v;
v = nullptr;
}
}
void AssignMemory(string *&v, int n) {
if (v != nullptr) {
FreeMemory(v);
}
if (n>=0) {
v = new string[n];
}
}