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