111
222
333
344
ptr++ ->u do posst increment
hence it goes to 1
ptr-p=*(&(arr+1)-&arr)=1
llrly for other cases
when u do *ptr++ due to operator precedence ptr++ is done and then
dereferenced.
hence u get 222
next *++ptr
the ptr is incremented after dereferencing hence u get 333
next ++*ptr here the value t ptr s incrementas it is treated as++(*ptr)
hence u get 3 but others refer to location hence 44

On Sat, Jun 12, 2010 at 9:21 PM, divya <sweetdivya....@gmail.com> wrote:

> #include<stdio.h>
> int main()
> {
> static int arr[]={0,1,2,3,4};
> int *p[]={arr,arr+1,arr+2,arr+3,arr+4};
> int **ptr=p;
> ptr++;
> printf("%d %d %d\n",ptr-p,*ptr-arr,**ptr);
> *ptr++;
> printf("%d %d %d\n",ptr-p,*ptr-arr,**ptr);
> *++ptr;
> printf("%d %d %d\n",ptr-p,*ptr-arr,**ptr);
> ++*ptr;
> printf("%d %d %d\n",ptr-p,*ptr-arr,**ptr);
> return 0;
> }
> wat shd b the o/p n why...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to