What is the difference between char[] s and char * s in C? I understand that both create make 's' a pointer to the array of characters. However,
char s[] = "hello";
s[3] = 'a';
printf("\n%s\n", s);
prints helao
,while
char * s = "hello";
s[3] = 'a';
printf("\n%s\n", s);
gives me a segmentation fault. Why is there such a difference? I'm using gcc on Ubuntu 12.04.