next up previous 252
Next: Global Data
Up: Communication Between Routines
Previous: Arguments


Function Values

The second mechanism for passing data between routines is the return value of a function. FORTRAN makes a distinction between subprograms that return a value (functions) and those that do not (subroutines), whereas C does not. All C subprograms are functions that return a value (even the main program), although that value may be void. Since it is simply a value that is being returned, the mechanisms for returning scalar numeric values tend to be just that - a value is returned. However, things get more complicated in the case of functions returning things like character variables. This will be discussed further in machine dependencies.



next up previous 252
Next: Global Data
Up: Communication Between Routines
Previous: Arguments

CNF and F77 Mixed Language Programming -- FORTRAN and C
Starlink User Note 209
P.M. Allan
A.J. Chipperfield
R.F. Warren-Smith
19 January 2000
E-mail:ussc@star.rl.ac.uk