If you can't assign to arrays, then how can
int f(char str)
if(str == '\0')
str = "none";...
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.