On Jul 1, 12:07*pm, (EMail Removed) (Ike Naar) wrote:
> In article <(EMail Removed)>,
> sangeeta chowdhary *<(EMail Removed)> wrote:
>
> >int arr[]={0,1,2,3,4};
> >int *p[]={arr,arr+1,arr+2,arr+3,arr+4};
> >int **p=p;
>
> This is an error; you probably meant ``int **ptr = p;''.
>
> >now,
>
> >ptr++;
> >*ptr++;
> >*++ptr
>
> >are same,means we are incrementing ptr everytime.
>
> There are subtle differences.
> The first expression yields ptr, and, as a side effect, increments ptr.
> The second expression yields *ptr, and, as a side effect, increments ptr.
> The third expression yields *(ptr+1), and a a side effect, increments ptr..
>
> So, all three statements increment ptr as a side effect, but each
> statement produces a different value; it is only because you ignore
> the produced values, that the three statements are effectively the same.
>
> >but ++*ptr is not incrementiing ptr . Why?
>
> ++*ptr means ++(*ptr), that is, it increments *ptr,
> the value that ptr points at, not ptr itself.
Thanks a lot.
