amarapreet said:
hi gcc 3.4 says in a warning that %lf is not recognized as a scanf
format specifier is this right if so how to read in a double using
scanf thanks
"%lf" is the correct format specifier to read a double using scanf in
both C90 and C99.
You haven't shown us either your code or the warning. If you had
posted the exact code that you fed to the compiler (copy-and-paste a
complete program; don't try to re-type it) *and* the exact diagnostics
the compiler gave you, then we could probably tell you what the
problem is. Given the lack of information you've shared with us,
though, we can only guess.
Here's my guess. You wrote something like this:
double d;
scanf("%lf", d);
and the warning was something like this:
c.c:5: warning: format '%lf' expects type 'double *', but argument 2 has type 'double'
scanf needs the address of the object you're reading, not the value of
the object:
double d;
scanf("%lf", &d);
Don't blame me if I've guessed wrong. Show us the code and the
warning.