! This file: http://ftp.aset.psu.edu/pub/ger/fortran/hdk/ReshapeDemo.f90 ! program ReshapeDemo ! This example demonstrates use of an Array Constructor and the Reshape ! Intrinsic. integer, dimension(2,3) :: x integer :: I,J ! The array x is filled up in row major order, (the subscripts of ! dimension 2 vary the quickest,) This is specified by the ! ORDER=(/2,1/) specifier. The default Fortran ordering (without ! the ORDER option) is ORDER=(/1,2/), that is, column major order.. x = reshape((/ 1,2,3,4,5,6 /),(/ 2,3 /), Order=(/2,1/) ) write(unit=*,fmt="(1X,3I3)") ((x(I,J),J=1,3),I=1,2) ! Output is: ! 1 2 3 ! 4 5 6 end program ReshapeDemo