Consider the binary representation of 257 which is 100000001

which will be stored in little endain representation as least significant
eight bits + most significant eight bits as follows

00000001 | 00000001

now iptr on casting to char will point to least significant eight bits which
is 1, when u increment iptr it refers to most sig 8 bits which is also 1

hence the o/p will be : 1 1


hope it helps!

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



-- 
Cheers,

  Vicky

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