Using SCANF with DOUBLE precision variables...

Robert Vaughan vaughan at orion.UUCP
Fri Sep 26 07:57:14 AEST 1986

>> I have been wanting to read in some real numbers, preferably thru SCANF
>> ...
>> declared as DOUBLE.  (...)

Well, go ahead! K&R, page 149 gives the key to reading in double precision
number using the scanf family:
	"the conversion characters e or f may be preceeded by l (letter l)
	 to indicate that .. a pointer to double rather than float is
The code would look like

double foo;


After having my code bomb several times (unfortunately, I was not as lucky
as you - instead of zeroes, I got core dumps), I discovered this little
gem in K&R.

More information about the Comp.lang.c mailing list