MC logo
[^] Functions
[Ch. 1: Overview and History] [Syntax] [Names and Scope] [Types and Type Systems] [Semantics] [Functions] [Memory Management] [Imperitive Programs and Functional Abstraction] [Modular and Class Abstraction] [Functional Programming] [Logic Programming]
[Call-by-Reference] [Call-by-Value-Result] [Call-by-Name] [Dyn Link Example] [Dyn Link Example] [C++ Translation of Java Dyn Link] [Variable Location] [Parameter Passing Method Exercise]
      NA = NA + 3
      NB = NB + 5

      NX = 10
      NY = 25
      CALL F(NX, NY)
      PRINT *, NX, NY
      NX = 10
      CALL F(NX, NX)
      PRINT *, NX

If pass-by-reference is used, this gives the same result as the C++ expample:
13 30
If value-result is used, the results depend on which parameter is returned last. If done left-to-right, so NB is returned last, we get:
13 30
If we NA goes last, the last value is 13. This is because NA and NB are not alaises during the execution, each with an initial value of 10.