Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!virtech!cpcahil From: cpcahil@virtech.UUCP (Conor P. Cahill) Newsgroups: comp.lang.c Subject: Re: scanf doesn't work for variables of type double Message-ID: <1168@virtech.UUCP> Date: 16 Sep 89 00:34:14 GMT References: <12988@uhnix1.uh.edu> Organization: Virtual Technologies Inc Lines: 15 In article <12988@uhnix1.uh.edu>, jsmng@csune.cs.uh.edu writes: > Does anyone have any experience with this? According to K&R, %f for > double should be allowed in scanf. This is not true. %f is allowed for doubles in printf since float parameters are automatically converted to doubles, but for scanf() you must use %lf for doubles. See K&R1 pg 149, K&R2 pg 158, or RTFM scanf(2) man page. -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+