Parameter Passing: Difference between revisions

Content added Content deleted
m (Small typos)
(→‎Example Fortran: (f90 intent))
Line 30: Line 30:
===Example [[Fortran]]===
===Example [[Fortran]]===
Early versions of the language used only by reference parameter passing for the arguments.
Early versions of the language used only by reference parameter passing for the arguments.

Starting from Fortran 90 (and later), functions and subroutines can specify an ''intent'' for the argument; intent can be: '''in''' (unmodificable argument), '''out''' (argument used to return a value; the starting value must be intended not significative, undefined), '''inout''' (argument both is intended for input and can be modified, i.e. return the value modified by the function/subroutine).

Trying to modify an argument with ''intent in'' triggers an error at compile time.