Possible Duplicates:
Difference between char *str="STRING" and char str[] = "STRING"?
Need some help with C programming
while this snip gets segmentation fault
int main(void) {
char* str ="abcde";
str[strlen(str)-1] ='\0';
printf("%s",str);
return 0;
}
If I put
char str [] ="abcde";
instead of the pointer that works perfectly, do you have an idea why so?