Gill,
Things get a lot easier if you start using the C++ string class instead of C-style character arrays. With the string class, assignment works the way you would expect it to. Since you're passing it into a function, you'd need to pass by reference to get the changes to appear outside the function. The new GetInput() would look like this:
void GetInput(string& name)
{
cout << "Enter a name :";
cin >> name;
name = "John";
cout << "In function:" << name << endl;
}
----
Scott J. Kleper
Author, "Professional C++"
(Wrox, 2005)
|