On Tue, Apr 20, 2010 at 6:29 PM, nitin_bits_hyd <[email protected]> wrote:
> i tried the following code in gcc and c-free and i got two different
> outputs
>
> #include<stdio.h>
> int main()
> {
> int p;
> p=5;
> printf("%f",p);
> return 0;
> }
>
> which of the compilers should i trust
>
> help please
>
> output gcc
> -0.015234
>
> output c-free
> 0.000000
>
i believe that gcc should give the output : 0.000000
you could try :
#include<stdio.h>
int main()
{
int p;
p=5;
printf("%f",(float)p);
return 0;
}
--
VISHAL GARG
Linux User #487206
Web : www.vishalgarg.tk
Blog : www.vishal-blog.tk
Twitter : http://twitter.com/vishalgarg09
IRC Nick : tux_addict, lamda_vishal
"In a world without fences and walls, who needs (Bill)Gates and
(Microsoft)Windows?"
--
l...@iitd - http://tinyurl.com/ycueutm
Subscription settings: http://groups.google.com/group/iitdlug/subscribe?hl=en