The list of scalars are placed into the array in order. The size of the constructor must equal the size of the array.
real, dimension(6) :: A, B real, dimension(2,3) :: C A = (/1.0,2.0,3.0,4.0,5.0,6.0/) B = (/ (i, i=1,6) /) C = RESHAPE( (/1.0,2.0,3.0,4.0,5.0,6.0/), (/2,3/) )The B definition contains an implied DO loop (the values of i generated by the construct ``DO i=1,6'').
Only one dimensional constructors are allowed; to initialize higher rank matrices, we need to explicitly RESHAPE the constructor to the desired shape.
We can use constructors to initialize arrays, for example
integer, dimension(6) :: A = (/ (i, i=1,6) /) real, dimension(2,3), parameter :: & C = reshape( (/1.,2.,3.,4.,5.,6./),(/2,3/))