next up previous contents
Next: Array Bound Violations Up: Input of Arrays Previous: Input of Arrays

 

Array I/O Example

Consider the matrix A:

  figure7575
Figure 12: Visualisation of the array a

The PRINT statements in the following program

   PROGRAM Owt
    IMPLICIT NONE
     INTEGER, DIMENSION(3,3) :: A = RESHAPE((/1,2,3,4,5,6,7,8,9/))
      PRINT*, 'Array element   =',a(3,2)
      PRINT*, 'Array section   =',a(:,1)
      PRINT*, 'Sub-array       =',a(:2,:2)
      PRINT*, 'Whole Array     =',a
      PRINT*, 'Array Transp''d =',TRANSPOSE(a)
   END PROGARM Owt

produce on the screen,

    Array element    = 6
    Array section    = 1 2 3
    Sub-array        = 1 2 4 5
    Whole Array      = 1 2 3 4 5 6 7 8 9
    Array Transposed = 1 4 7 2 5 8 3 6 9

Return to corresponding overview page gif


next up previous contents
Next: Array Bound Violations Up: Input of Arrays Previous: Input of Arrays

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.