Originally posted by Unregistered
l-value can not be Array
but howcome this below is correct?
char array[]="hello";
Just an arays can be initialized, so alos can strings. The string can be intialized as the following exmaple:
Code:
char str[ ] = {'s', 't', 'r', 'i', 'n', 'g', '\0'}; // notice that this string is ends up with a null character
However, C concedes that strings are a special kind of character array by providing a shortcut:
PHP Code:
char str[ ] = "string"; // notice that we don't need to insert the null character
I hope that helps.