NOTE: THIS QUESTION TURNS OUT TO ALREADY BE ANSWERED HERE → Is it possible to modify a string of char in C?
Assume we want to create side effects this way:
void sideEffect(char *str) {
  str++;
  *str = 'X';
}
Why are side effects on dynamically allocated memory allowed through functions?:
int main(int argc, char **argv) {
  char *test = malloc(4 * sizeof(char));
  strcpy(test, "abc");
  printf("before: %s\n", test); // before: abc
  sideEffect(test);
  printf("after: %s\n", test); // after: aXc
  free(test);
}
And why are side effects on statically allocated memory not allowed through functions?:
int main(int argc, char **argv) {
  char *test = "abc";
  printf("before: %s\n", test); // before: abc
  sideEffect(test); // creates segmentation fault :(
  printf("after: %s\n", test);
}
 
    