I'm a little bit confused with pointers at the moment, could someone explain to me the reason why attempting to change a char**
with strcpy()
causes a segmentation fault
?
void *change_string(char **string) {
char *add = "Changed!";
strcpy(*string, add);
return 0;
}
int main() {
char *p = "Original-";
change_string(&p);
printf("%s",p);
}