Problem returning doubles from a function

Farrell Woods ftw at masscomp.UUCP
Mon Mar 27 04:40:28 AEST 1989


In article <39722 at csvax1.cs.tcd.ie> omahony at csvax1.cs.tcd.ie (Donal O'Mahony - OMAHONY at 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 at masscomp.com
1 Technology Way				uucp:   {backbones}!masscomp!ftw
Westford, MA 01886				OS/2:   Half an operating system



More information about the Comp.lang.c mailing list