Re: float
Nanakos Chrysostomos <[email protected]>
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <[email protected]> |
On 8/1/2010 19:11, Michal Nazarewicz wrote:
>> On 8/1/2010 18:30, phoenixxz wrote:
>>
>>> float i=1.34;
>>> printf("%f",i);
>>>
>>> ->> 0
>>> why?
>>>
> Nanakos Chrysostomos <[email protected]> writes:
>
>> printf("%lf",i);
>>
> %lf is actually invalid format (though glibc will gladly treat it the
> same way it treats %f). When passing a float value to a function with
> variable number of arguments it is promoted to double.
>
>
Sorry for the previous one...
it could be then.
printf("%f",(double)i);