You can pass a string into a function as an argument and take a string reference as a parameter in the function.
1 2 3 4 5 6 7 8
// inside main
edit(str);
// ...
// edit function
void edit(string& s) {
s[1] = 'A';
}
That would work, although s[1] points to the second character in the string because indices start at 0.
A string isn't an array, it is an object of the string class. The reason you can use indexing on a string is because the [] operator is overloaded for the string class (something that you will eventually cover).
What you were doing above is passing a pointer. For it to work the way you had done it your edit function would have to dereference the pointer: