#include <iostream>
usingnamespace std;
string line[5] = {" ", " ", " ", " ", " " };
//string array "line" declared
string Something(int x, string line[5])
{
line[x] = "Hi!";
return line[x];
}
//"Something" function assignes "Hi" to one member of the string-array "line"
int main()
{
Something(5, line);
cout<<line[1]<<line[2]<<line[3]<<line[4]<<line[5]<<endl; //every member of "line" is printed
system("pause");
return 0;
}
the Something function will assign "Hi!" to one of the 5 positions of the string-array,
and return the modified string-array member to main.
Then main will print out the whole string-array.
The only two limits on the return types of functions in C++ are that they cannot be function types and cannot be array types (but can be references to such things)
Return a std::vector<std::string> instead, or an std::array<std::string, 50> (also known as boost::array for older compilers)