next up previous contents
Next: Allocatable Arrays Up: Arrays Previous: The RESHAPE Intrinsic Function

Array Constructors in Initialisation Statements

Named array constants can be created:

    INTEGER, DIMENSION(3), &
       PARAMETER :: Unit_vec = (/1,1,1/)
    CHARACTER(LEN=*), DIMENSION(3),    &
     PARAMETER :: lights =             & 
             (/'RED  ','BLUE ','GREEN'/)
    REAL, DIMENSION(3,3), PARAMETER :: &
          unit_matrix = RESHAPE( &
          (/1,0,0,0,1,0,0,0,1/),(/3,3/))

In the second statement all strings must be same length.

For more information, click here gif

Now try this question gif


next up previous contents
Next: Allocatable Arrays Up: Arrays Previous: The RESHAPE Intrinsic Function

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 18:56:08 GMT 1996
Not for commercial use.