got to do with the internal representation of various types. i think. For eg, float is composed of a mantissa, exponent etc. So if u try to print a floating point as an int, you'll get unpredictable outputs.
On Mon, Sep 5, 2011 at 1:36 PM, Aman Kumar <[email protected]> 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 [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, Shachindra A C -- 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.
