result is undefined.floating points are represented using IEEE ormat which
is not same as ints.so it will truncate fractional part and print result
.result is nt defined

On Mon, Sep 5, 2011 at 1:41 PM, SANDEEP CHUGH <sandeep.aa...@gmail.com>wrote:

> u r printing a floating point number using %d format specifier.
> dnt assume that while printing a float using %d , the compiler will chop
> the digits after decimal places.. its not so.. the result will be
> undefined..
>
>
> On Mon, Seot definep 5, 2011 at 1:36 PM, Aman Kumar 
> <amanas...@gmail.com>wrote:
>
>>
>>
>> #include<stdio.h>
>> int main()
>> {
>>  float a=3.2;
>>  printf("%d\n\n",a);                //line 1
>>  printf("%d",*(int *)&a);         //line 2
>>
>> }
>>
>>
>> o/p(gcc comppiler)     =     -1610612736
>>
>>                                       1078774989
>>
>> i am not getting why and how these /p  r coming .
>>
>> what is difference between line 1   and line 2?
>>
>> reply asap
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to