111

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 19 21:07:59 PST 2016


On 2/19/16 11:15 PM, Lisa wrote:
> module main;
>
> import std.stdio;
> import std.math;
>
> int main() {
>      int A, B, C;

>      writef("A = ");
>      readf("%lf", %A);

You want &A, not %A.

Also, note that you declared A, B, C as integers, but are using %lf 
which is for doubles. However, readf is much smarter than scanf. You can 
just use %s as format specifier, and it will figure out what should 
happen based on the given type.

-Steve


More information about the Digitalmars-d-learn mailing list