July 03, 2004
Sorry to bother you, but whenever i try to compile a program with
gets("%f", mph);      or printf("%f", &kmph);    in it, where im using gets()
for number inputand printf for number output, the compiler gives me the error:

1 actual arguments expected for printf, had 2

so, it seems to think that me setting the function up for printing numbers is actually using 2 arguments, when it's not.  If you have advice on how i can fix or prevent this from happening, please reply.

Pifs_of_blu
July 05, 2004
Compiler may think of "printf" as taking 1 parameter only if you haven't
included stdio.h and compiler autoprototyped this functions from first call,
i.e:
    printf ( "..." );          // not knowing anything about printf,
compiler may think that it accepts only one param
    printf ( "%d", 2 );    // certainly compiler will give error here.

Make sure you #include <stdio.h> before you  use printf or scanf
Also, "gets" is not for formatted input, use scanf instead. But as for my
feeling, I don't like scanf and never had luck to make it work.
:-)

Nic Tiger.

"Pifs" <Pifs_member@pathlink.com> wrote in message news:cc51eq$19ic$1@digitaldaemon.com...
> Sorry to bother you, but whenever i try to compile a program with
> gets("%f", mph);      or printf("%f", &kmph);    in it, where im using
gets()
> for number inputand printf for number output, the compiler gives me the
error:
>
> 1 actual arguments expected for printf, had 2
>
> so, it seems to think that me setting the function up for printing numbers
is
> actually using 2 arguments, when it's not.  If you have advice on how i
can fix
> or prevent this from happening, please reply.
>
> Pifs_of_blu