char my_string[]="Hello"; is ok. it copied into the stack memory. but char *my_string="Hello" is pointing to read only memory. so cannot modify. if you want to use heap memory, use malloc and copy the string to the heap.
– Junhee ShinMar 29 '18 at 07:24
This is not a duplicate of that specific question. This is about writing to string literals.
– marcolzMar 29 '18 at 07:24
It's more a duplicate of https://stackoverflow.com/questions/3303411/string-literals-vs-const-char-in-c
– marcolzMar 29 '18 at 07:35