257 is stored as
B A
00000000 00000000 00000001 00000001
So iptr if int* will be pointing to this above
So if we typecast it as char* then it will point to 00000001 (A)
and *ptr+1 will point to 00000001(B)
Hope this clear .
On Mon, Jul 25, 2011 at 11:41 AM, aditya kumar <[email protected]
> wrote:
> main()
> {
> int i = 257;
> int *iPtr = &i;
> printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );
> }
>
> can any one explain me the o/p ??
>
> --
> 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
Rajeev N B <http://www.opensourcemania.co.cc>
--
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.