I think while assignment the type conversion will take place. Whether you
write it or not.
check this out: http://ideone.com/y36vj
^^ Just giving off warnings, but it is working.

On 15 August 2011 14:14, aditi garg <[email protected]> wrote:

> I think dis is bec int occupies 4 bytes while char occupies 1 byte so in
> the memory when we save as int dey are saved as 2000 3000 4000
> now whn u take a char pointer pointing to dis array and u increment it by 1
> dey will move only by 1 byte and thus u get 0...
> u can verify the result by removing char* typecast and u will get the ans
> as 2 3
>
>
> On Mon, Aug 15, 2011 at 1:59 PM, Nitin <[email protected]> wrote:
>
>> #include<stdio.h>
>> main()
>> {
>> int arr[3]={2,3,4};
>> char *p;
>> p=arr;
>> p=(char *)((int *)(p));
>> printf("%d",*p);
>> p=(char *)((int *)(p+1));
>> printf("%d",*p);
>> }
>> it is giving 2,0 why it is giving 0 ..>??
>>
>> --
>> 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.
>>
>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New Delhi
>
>
>  --
> 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.
>



-- 
___________________________________________________________________________________________________________

Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees

-- 
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.

Reply via email to