[net.lang.f77] Function returns

scott@gitpyr.UUCP (Scott Holt) (05/21/85)

ok...time for a stupid question for any of you guys out there with a 
Standard Fortran ( as in ANSI ) definition handy...

Do functions return the first or the last value assign to them?
                             - Scott

-- 
---------
"Its better to die on your feet than to live on your knees!"

Scott Holt
Georgia Tech Po Box 36199
Atlanta, GA 30332

...!{akgua,allegra,amd,hplabs,ihnp4,masscomp,ut-ngp}!gatech!gitpyr!scott
...!{rlgvax,sb1,uf-cgrl,unmvax,ut-sally}!gatech!gitpyr!scott

woods@hao.UUCP (Greg Woods) (05/24/85)

> ok...time for a stupid question for any of you guys out there with a 
> Standard Fortran ( as in ANSI ) definition handy...
> 
> Do functions return the first or the last value assign to them?
>                              - Scott

  The function name, within a function, is just a pointer to a location in
memory. When something is assigned to the function name variable, it is loaded
into that location. When a return statement is executed, the value in that
location is the function returned value. Thus, the *last* value assigned
to the function name variable before execution of a return statement is
the returned value.

--Greg
-- 
{ucbvax!hplabs | allegra!nbires | decvax!noao | harpo!seismo | ihnp4!noao}
       		        !hao!woods

CSNET: woods@NCAR  ARPA: woods%ncar@CSNET-RELAY
   
     "...I may not be right but I've never been wrong
      It seldom turns out the way it does in the song..."