prev up next   top/contents search

comp.lang.c FAQ list · Question 6.6

Q: If you can't assign to arrays, then how can

	int f(char str[])
		if(str[0] == '\0')
			str = "none";

A: In this code, str is a function parameter, so its declaration is rewritten by the compiler as described in question 6.4. In other words, str is a pointer (of type char *), and it is legal to assign to it.

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

Hosted by Eskimo North