prev up next   top/contents search

comp.lang.c FAQ list · Question 11.8b

Q: If you can't modify string literals, why aren't they defined as being arrays of const characters?

A: One reason is that so very much code contains lines like

	char *p = "Hello, world!";
which are not necessarily incorrect. These lines would suffer the diagnostic messages, but it's really any later attempt to modify what p points to which would be problems.

See also question 1.32.

prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North