intro_passing_by_address_value
Previous differences between passing function arguments by-value
and by-address did not explicitly have to be recognized. Now that
the console environment allows the C language one can and should be
aware of these differences.
Past CLIB routines were written for interface to the default FORTRAN
argument passing mechanism: by address. The default for C is by
value. This does not mean that one cannot interface between the two.
Either passing mechanism is supported. In FORTRAN one can surround an
argument, X, by %VAL(X). This assures X is passed by value. And,
of course, the C language allows passing by address by using a pointer
or preceeding the approriate argument by "&".
You need to have the address of a memory location, not the content,
to modify the contents of the memory location. In FORTRAN one could
modify any passed argument; not so in C.
Another difference in argument passing between FORTRAN and C involves
character strings. FORTRAN passes CHARACTER variables by a
structure called a string descriptor. The C language always passes
strings by a simple pointer to the first character in the string.
If a routine wants a string passed by a simple address (argument
type ".i1a.r"), a FORTRAN module can accomplish this by surrounding
the passed argument with a %REF operator (%REF(X)).
See also 'intro_help'.