The string "Hello WoRLd! Today’s temperature is 34°C.", which str points to, is kept in read-only memory, so when you try to write to it, the system kills your program.
You can tell the compiler to make a copy of it in writable memory and then get a pointer to it:
1 2
char string[] = "Hello WoRLd! Today’s temperature is 34°C.";
char *str = string;
Yes, it is possible to modify the content pointed to.
What you are doing wrong is modifying read only memory which that "Hello world" string literal is. An expression like line 2 should at least give a warning like this:
warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]