Possible Duplicate:
What is the difference between char s[] and char *s in C?
Can the statements
char str[]="abcdef";
and
char *str="abcdef";
be used to explain the char array and string literal in C?
What is relationship between char array and string literal?
What is actually usage of char array except storing a string literal?
A string literal is an array of
charthat is not modifiable.C99 6.4.5 p2:
And then, in C99 6.4.5 p5:
The draft C11 I have has similar wording. I believe it is worded with “have type
char” precisely to allow a string literal to be assigned tochar *. However, the standard does go on to say in C99 6.4.5 p6:So assignable, but not modifiable.
A string literal can be used as an initializer for an array of
char. From C99 6.7.8 p14: