www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/01/07/15:01:12

From: Richard Shields <richards AT sequent DOT com>
Subject: scanf woes
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Thu, 7 Jan 93 11:09:21 PST

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.

I have successfully used scanf to read in a string but anything else seems
to fail.

-Rich


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019