(int *)60 => 60 is treated as address and 60 = 0x3c
similarly 71 = 0x47

On Sun, Oct 14, 2012 at 11:18 AM, bharat b <bagana.bharatku...@gmail.com>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 <verma....@gmail.com> 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.bharatku...@gmail.com>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 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.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> 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.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
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.

Reply via email to