S
Suddn
Help me get my mind around passing string types to a function.
I need to have the function modify the string types and get them back.
Normaly I would just return the modified string but I need to modify about
five different strings.
I thought that strings were passed by reference in C/C++ but when I pass
the strings in they remain unaltered in the calling function. I did test
the function being called and they are being althered there.
Can someone please show me the syntax that I need.
i.e.
void foo(string s, string s2)
{
}
int main(int argc, char *argv[])
{
string a, b;
foo(a, b);
return 0
}
Or whatever is correct (the above doesn't work.)
Thanks.
I need to have the function modify the string types and get them back.
Normaly I would just return the modified string but I need to modify about
five different strings.
I thought that strings were passed by reference in C/C++ but when I pass
the strings in they remain unaltered in the calling function. I did test
the function being called and they are being althered there.
Can someone please show me the syntax that I need.
i.e.
void foo(string s, string s2)
{
}
int main(int argc, char *argv[])
{
string a, b;
foo(a, b);
return 0
}
Or whatever is correct (the above doesn't work.)
Thanks.