On 7/15/07, Nico Heinze <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
>
> --- 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] );

>  > }
>  >

and in this compilation has no errors
but when I execute the code this message appears
segmentation fault


>
>
>
>
>  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
>
I saw the same code in the BASH command line programs but instead of
name it was argv
and it has the same syntax
???????????

Reply via email to