string terms[10];
...
void change(string* array[])
...
array[0] = "Bonjour";
... of course "string terms[10]" is a different type from "string* array[]" - the first is talking about an array of strings, the second is talking about an array of pointers to strings. And of course "array[0]" is differently typed from "Bonjour"; the first is an element of an array of pointers to strings, i.e. a pointer to a string, and the second is a char array.
Char arrays correspond to strings, not to pointers to strings, so you want your function prototype to just be
void change(string array[])
and then array[0] will of course be a string. If you can''t assign that directly from a char[], try:
array[0] = string("Bonjour");
I think that will work. Don''t you love how the way that C++ makes it possible to do low-level stuff, keeps interfering with your attempts to do things at a higher level :/
Problems with Strings
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement