Exercise: Array Reversal
Part 1: Subroutine
Create a subroutine to reverse the order of a one-dimensional array of integers. The subroutine name must be ireverse and it takes the array as the sole argument. For example, if the array on input is (3, 17, -5, 2, 614), then the array on output should be (614, 2, -5, 17, 3). Ensure that the subroutine compiles into object code without errors or warnings.
Part 2: Program
Write an interface block for the subroutine. Create a short program using your interface block which calls the subroutine with sample data and displays the results. Compile this program separately and then link its object code against your subroutine object code. Run the resulting program to verify that your subroutine works.
Part 3: Share
Exchange your subroutine object code only with your neighbour. Now, without recompiling, link your test program against their subroutine object. Check that the resulting program still runs and produces the same output.
Solutions: Fortran.