Mail Archives: djgpp/1993/01/08/09:00:06
Richard Shields <src4src!mcdhup!rutgers!sequent.com!richards> writes:
>
> Has anyone had any trouble using scanf to read in a floating point value?
>
> I tried this in my code:
>
> double amount;
>
> scanf("%f", amount);
> printf("amount = %10.2f\n", amount);
>
>
> When I run the program and enter 4.25 the printf statement prints 0.00.
>
You told scanf to read in a "float", not a "double". Need to say "%lf".
alane AT wozzle DOT linet DOT org (J. Alan Eldridge)
Fido: The University of Walamaloo 1:272/38.473
- Raw text -