@vijay ....
u take normalised form of 5.375 wrong .....
actual normalised form of 5.375 = 0100 1000 1010 1100 0000 0000 0000 0000








On Sun, Aug 21, 2011 at 10:12 AM, Vijay Khandar <[email protected]>wrote:

> but why only o/p-00 00 AC 40 and not AC 40 00 00 or 00 AC 40 00 or 40 AC 00
> 00etc , plz explain in detail how p[0] pts to 00 and p[1] pts to 00 and p[2]
> pts AC or 1010 1100 and p[3] pts to 40 or 0100 0000 ONLY in this
> way..............Vijay Khandar...........
>
>
> On Sat, Aug 20, 2011 at 12:31 PM, Dipankar Patro <[email protected]>wrote:
>
>> float is 4 bytes.
>> so a=3.75 will be stored in 4 bytes in memory.
>>
>> the moment you have a pointer referring to the same memory location but
>> type cast to (char *), the pointer will refer to character i.e. 1 byte.
>> ^^ this explains the p[0] , p[1], p[2], p[3] <- 4 bytes of the 3.75
>>
>> now finally the o/p
>> 00 00 AC 40
>> ^^ it is in little endian format. i.e the data bytes are stored in memory
>> is reverse format.
>>
>> On 20 August 2011 11:21, 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.
>>>
>>>
>>
>>
>> --
>>
>> ___________________________________________________________________________________________________________
>>
>> 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.
>>
>
>  --
> 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.
>



-- 
Rahul Tiwari aka  " DONE "
B Tech Final Year
Information Technology
Motilal Nehru National Institute of Technology , Allahabad
9838339030

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