a[]= {1, 2, 3, 4, 5}
a
&a
a+1
&a+1
&a is address of whole array...so &a+1 means next element after array
completion.
so ptr-1 will point to 5
...
On Fri, Sep 16, 2011 at 1:25 PM, Anup Ghatage <[email protected]> wrote:
> #include<stdio.h>
> int main()
> {
> int a[5]={1,2,3,4,5};
> int *ptr=(&a + 1);
> printf("%d %d\n",*(a+1),*(ptr-1));
> return 0;
> }
>
> Find the output!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.