This is an undefined behaviour as you are trying to modify string literal
* c will give the character 'g' , but when applying this, ++ * c means what you are trying to do
*c=*c+1; which modifies the string and its undefined in the standard language
It is better to use a char array to solve this problem, since the literal "string" is stored in readonly memory, and changing it causes this.
source share