@Bharat: 0x notation indicates hexadecimal, so 0x11 = 1*16 + 1 = 17. Dave
On Sunday, October 14, 2012 12:48:24 AM UTC-5, bharat wrote: > @Ashok : I didn't get this answer .. > i=0x3c --> what is this address .. variables has addresses but not the > values right? we are not storing 60 any where right? > 0x11 = 3 in decimal format not 11 base 10. > > typecasting to (int*) needs an address right? > I mean > int b=10; > int * a=(int*)&b; > > > > On Sat, Oct 13, 2012 at 9:10 PM, Ashok Varma <verm...@gmail.com<javascript:> > > wrote: > >> This gives a clear explanation: >> >> #include<stdio.h> >> main(){ >> int *i,*j; >> i=(int*)60; >> j=(int*)71; >> >> >> printf >> <http://www.opengroup.org/onlinepubs/009695399/functions/printf.html>("%p %p >> %d",i,j,j-i);} >> >> >> op: 0x3c 0x47 2 >> >> 0x47 - 0x3c = 0x11 and hence j-1 = 2 (11/4 = 2, size of int = 4 bytes) >> >> >> On Sat, Oct 13, 2012 at 3:36 PM, bharat b >> <bagana.bh...@gmail.com<javascript:> >> > wrote: >> >>> #include<stdio.h> >>> main() >>> { >>> int *i,*j; >>> i=(int*)60; >>> j=(int*)71; >>> printf("%d",j-i); >>> } >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Algorithm Geeks" group. >>> To post to this group, send email to algo...@googlegroups.com<javascript:> >>> . >>> To unsubscribe from this group, send email to >>> algogeeks+...@googlegroups.com <javascript:>. >>> 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 algo...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> algogeeks+...@googlegroups.com <javascript:>. >> 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 view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/b1AQOc8Y9wQJ. To post to this group, send email to algogeeks@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.