When you pass something into a function, you pass it by value. This means that the function operates on a copy of that thing.
This applies to pointers too. If you pass a char *, then a copy of that pointer gets made; the original pointer is not modified. If you want to modify the original pointer itself, then you need to pass its address, via a char ** argument.
Notes:
1. It's also worth pointing out that your code contains a memory leak. You dynamically-allocate some memory, and then lose the pointer to it, which means that you can never delete it.
2. In C++, you should generally avoid passing raw pointers around like this, because it causes pain and confusion. You should look into smart pointers.
modifytakes a parameter of typechar**and notchar*. Also, usestd::stringinstead.