C++ Function Parameter Modify a String Parameter via Pointers
#include <iostream> using namespace std; void myFunction(string *realmessage) { (*realmessage)[6] = 'i'; realmessage->replace(9, 1, ""); realmessage->insert(18, "ad"); realmessage->replace(15, 2, "in"); realmessage->replace(23, 7, "!"); realmessage->replace(4, 3, "ali"); } int main() //ww w . j a v a2 s . com { string message = "this is a test test test test"; cout << message << endl; myFunction(&message); cout << message << endl; return 0; }