> #include<stdio.h>
> int main()
> {
> int p;
> p=5;
> printf("%f",p);
> return 0;
> }
>
> which of the compilers should i trust

None? That is bad programming :)

gcc's output is 0 for me as well. One must note though that the size
of both int and float is the same (at least on my PC). I also tried
the following:

#include <stdio.h>
#include <string.h>
int main()
{
    int p;
    float r;
    p=5;
    memcpy(&r, &p, sizeof(float));
    printf("%f %f\n", p, r);

    return 0;
}

The output was: 0.000000 -0.000000


SB

-- 
l...@iitd - http://tinyurl.com/ycueutm

Subscription settings: http://groups.google.com/group/iitdlug/subscribe?hl=en

Reply via email to