On Fri, Aug 12, 2011 at 11:55 AM, Avinash Dharan <[email protected]>wrote:
> Pointer incrementation and subtraction are done in terms of memory blocks > and not addresses of memory. > For example, > > int *p; > p++; > > The pointer here jumps to the next integer location and not the next > address in memory. > Similarly,pointer subtraction will give the difference in indexes and not > the memory addresses. > If you try subtracting an integer pointer and a float pointer, it will be > an error. > > > On Fri, Aug 12, 2011 at 11:34 AM, rohit <[email protected]> wrote: > >> >> int main() >> { >> int a[5]={1,2,3,4,5}; >> printf("%d",&a[4]-&a[0]) >> } >> why it show 4 not 16? >> >> -- >> 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.
