return a string array in c++ code example
Example 1: return array of string in function c++
string* getNames() {
string* names = new string[3];
names[0] = "Simon";
names[1] = "Peter";
names[2] = "Dave";
return names;
}
Example 2: return array of string in function c++
delete[] names;