Possible Duplicate:
What is the difference between char a[] = “string”; and char *p = “string”;
char *str = "Hello";
printf("%c",++*str);
This gives segmentation fault on linux with gcc. The moment the first statement is changes to as
char str[10] = "Hello";
It works. What may be the reason?