--- In [email protected], "Ahmed Shabana" <[EMAIL PROTECTED]> wrote:
>
> when I try this code :
> 
> #include<stdio.h>
> main ()
> {
>         char *name[] = { "ligal month","jan","fed" };
>         printf( "%s\n" , (*++name)[1]);
> }
> 
> this error message appears in compilation
>   error: invalid lvalue in increment
> why ??????????????????????????

Because "name" is the name of an array. It is NOT a pointer.
Why do you want to increment "name" here at all?

To make it somewhat clearer: although in terms of indexing the name of
an array can be intermixed with a pointer to its first element, the
name of an array is still a name and hence something "constant" to the
compiler; on the other hand a pointer can be changed (except if
declared "const ...*..."). Still these two are different entities for
the language specifications.

Regards,
Nico

Reply via email to