5.375 in normalised form is - 0100 0000 1010 0000 1100 0000 0000 0000
As we type cast into char
so in little endian system it take 8 bits from last and store into p[0] ,
then it take next 8 bits store it into p[1] so on ...
In printf statement here X is specifier for float so it print hexadecimal
equivalent of binary number.


On Sat, Aug 20, 2011 at 11:21 AM, Vijay Khandar <[email protected]>wrote:

> If the binary equivalent of 5.375 in normalised form is - 0100 0000
> 1010 0000 1100 0000 0000 0000
>
> what is the o/p of following code-
> main()
> {
> float a=5.375;
> char *p;
> int i;
> p=(char *)&a;
> for(i=0;i<=3;i++)
> printf("%02X",(unsigned char)p[i]);
> }
>
> O/P= 00 00 AC 40
> Plz, Plz  anyone explain me in detail, how this o/p is coming?
> Vijay..........
>
> --
> 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.
>
>

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