1: The easiest way (especially for a VB programmer) is to use the string object:
2: You can create an array of string objects and pass them as Steve said, or you can use a vector:Code:#include <string> using std::string; string func() { return string("Hello"); } int main() { string x = func(); cout << x.c_str() << endl; return 0; }
Z.Code:#include <string> #include <vector> using std::string; using std::vector; void func(vector<string>& strings) { for(int i = 0; i < strings.size(); ++i) cout << strings[i].c_str() << endl; } int main() { vector<string> x; x.push_back(string("Hello")); x.push_back(string("Goodbye")); func(x); return 0; }




Reply With Quote