There's a difference here between C-style strings and C++ std::strings. A C-style string is an array of characters, so it gets passed to a function as a pointer (which, in C, is as close as we get to pass-by-reference). A C++ string is a single type (not an array), so it needs to be passed by reference (using &) if we want changes to be seen in the main program.