`string s = "hello";`  declares a string literal.  By definition, it is immutable.  If you try to change a char in that string, you will segfault.

Have a look at [my post about string literals](https://github.com/curiouskiwi/cs50x-help/blob/master/stringliteral.md) for more info.