&array_name always has the size of whole array...so whenever u increase this, it will get incremented by size of the whole array..as in this case , &a+1 points to next set of 5 numbers
On Fri, Sep 16, 2011 at 10:17 PM, Anup Ghatage <[email protected]> wrote: > What does one mean by 'address of the whole array' ? > > > On Fri, Sep 16, 2011 at 8:11 PM, mohan kumar <[email protected]>wrote: > >> thank to explain to this problem....... >> >> >> >> On Fri, Sep 16, 2011 at 1:40 PM, Yogesh Yadav <[email protected]> wrote: >> >>> 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. >>> >> >> >> >> -- >> >> - *MOHAN KUMAR* >> >> >> -- >> 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. >> > > > > -- > Anup Ghatage > > -- > 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. > -- Regards, Brijesh Upadhyay CSE , final year. Thapar University -- 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.
