1void FreeMemory(string *&v) {
2 if (v != nullptr) {
3 delete[] v;
4 v = nullptr;
5 }
6
7}
8
9void AssignMemory(string *&v, int n) {
10 if (v != nullptr) {
11 FreeMemory(v);
12 }
13 if (n>=0) {
14 v = new string[n];
15 }
16}
17