I was trying to make a function that removes the string terminator and adds a newline character instead to a string. The way i do it leads to a segfault. And i am unable to wrap my head around why my string is immutable and how to make it work with my implementation. Thanks a lot for any help.
int main () {
char* value = "message";
value[7] = '\n';
int success = write(1, value, 7);
if (success == -1) {
printf("write failed");
}
}