If you do char s[6] = {'h','e','l','l','o','\0'};
you put 6 char
s into an array on the stack. When you do char *s = "hello";
there's only a pointer on the stack and the memory that it points to may be read only. Writing to that memory causes undefined behavior.