writes:
> On Dec 3, 3:49 pm, pete <pfil...@mindspring.com> wrote:
>> Ian Collins wrote:
>>
>> > RoS wrote:
>> > > the format for conversion of double in the function printf is
>> > > "%f" or "%lf" or both?
>>
>> > > for example
>> > > printf("%f", (double)0.0);
>> > > printf("%lf", (double)0.0);
>> > > are both ok?
>>
>> > Yes they are equivalent,
>> > the l modifier has no effect for the f specifier.
>>
>> That's the case for C99.
>> For C89,
>> a function call to printf is undefined
>> if "%lf" is the first argument.
>
> The first? "%d %lf" is not undefined?
Yes, "%d %lf" is undefined for C89/C90's printf. He said "if", not
"if and only if".
(Incidentally, given printf("%d %lf", x, y), the first *argument*
isn't %d; it's the string "%d %ld".)
--
Keith Thompson (The_Other_Keith) <kst->
Looking for software development work in the San Diego area.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"