Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!ulowell!masscomp!ftw From: ftw@masscomp.UUCP (Farrell Woods) Newsgroups: comp.lang.c Subject: Re: Problem returning doubles from a function Message-ID: <1337@masscomp.UUCP> Date: 26 Mar 89 18:40:28 GMT References: <39722@csvax1.cs.tcd.ie> Reply-To: ftw@quasar.masscomp.UUCP (Farrell Woods) Organization: Concurrent Computer Corporation - Westford, Ma Lines: 19 In article <39722@csvax1.cs.tcd.ie> omahony@csvax1.cs.tcd.ie (Donal O'Mahony - OMAHONY@cs.tcd.ie) writes: >Can anone explain the problem with the following program (made up of >2 files). [example deleted] You get garbage for output, right? In main.c, you have no prototype in scope for the function ``store_length'' in rt1.c. The compiler defaults to casting the argument to store_length to an int, where you would have preferred it to pass a double. The solutions are: explicitly cast the argument to double, or (better still) create a prototype in main.c for the function store_length. -- Farrell T. Woods Voice: (508) 392-2471 Concurrent Computer Corporation Domain: ftw@masscomp.com 1 Technology Way uucp: {backbones}!masscomp!ftw Westford, MA 01886 OS/2: Half an operating system