scanf doesn't work for variables of type double

jsmng at csuna.cs.uh.edu jsmng at csuna.cs.uh.edu
Tue Sep 19 06:05:55 AEST 1989


I posted  a question about scanf last week. I could not scanf a double
variable using %f. Thanks to many readers' contribution (There were too
many to list out all names). My mistake was not reading my old K&R edition
careful enough. Using %lf and %F would have worked. Printf accepts %f
for float and double but not scanf. Mainly because the float parameters
passed by value to  printf will be converted to double. Scanf is passed
by reference, so I have to do it right.
James



More information about the Comp.lang.c mailing list