<!-- hamlet
<!-- copytar
examples/                                                                                              755    1107     770            0  5477466167   5733                                                                                                                                                                                                                                                                                                                                                                      examples/aparm1.f                                                                                      644    1107     770         1421  5477466167   7346                                                                                                                                                                                                                                                                                                                                                                      C Illustrates the equivalence of array elements and simple variables

C Created:  Joe Zachary, November 1, 1992
C Modified:


C This subroutine exchanges the values of its two arguments

      SUBROUTINE SWAP (X, Y)

      IMPLICIT NONE
      INTEGER X, Y, Z

      Z = X
      X = Y
      Y = Z

      RETURN
      END


C The main program exercises SWAP

      PROGRAM TESTER

      IMPLICIT NONE
      INTEGER A(5), B, C

      B = 1
      C = 2
      A(2) = 1
      A(3) = 2

      PRINT *, 'Before,    B = ', B, ' and    C = ', C
      CALL SWAP(B, C)
      PRINT *, 'After,     B = ', B, ' and    C = ', C

      PRINT *, 'Before, A(2) = ', A(2), ' and A(3) = ', A(3)
      CALL SWAP(A(2), A(3))
      PRINT *, 'After,  A(2) = ', A(2), ' and A(3) = ', A(3)

      STOP
      END
                                                                                                                                                                                                                                               examples/aparm2.f                                                                                      644    1107     770         1475  5477466167   7360                                                                                                                                                                                                                                                                                                                                                                      C Illustrates passing arrays as arguments.

C Created:  Joe Zachary, November 1, 1992
C Modified:


C This subroutine computes the dot product of two REAL arrays
C (X and Y) of length 5.  The answer is communicated back
C via Z.

      SUBROUTINE DOTPROD (X, Y, Z)

      IMPLICIT NONE
      INTEGER I, SIZE
      PARAMETER (SIZE=5)
      REAL X(SIZE), Y(SIZE), Z(SIZE)

      DO I = 1, SIZE
         Z(I) = X(I) * Y(I)
      ENDDO

      RETURN
      END


C The main program exercises DOTPROC

      PROGRAM TESTER

      IMPLICIT NONE
      INTEGER I, SIZE
      PARAMETER (SIZE=5)
      REAL A(SIZE), B(SIZE), C(SIZE)

      DO I = 1, SIZE
         A(I) = I
         B(I) = SIZE
      ENDDO

      PRINT *, 'A   = ', A
      PRINT *, 'B   = ', B

      CALL DOTPROD(A, B, C)

      PRINT *, 'A*B = ', C

      STOP
      END
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   