program exf3 ! exf3.f90 example file more complete structure, list, arrays, matrix integer, parameter :: n = 4 ! constant character (len=5) :: msg = "short" ! char for string character*4, dimension(3) :: as = (/"abcd", "wxyz", "more"/) integer, dimension(n) :: vec = (/1, 2, 4, 8/) ! initialize an array, any type integer, dimension(4,3) :: mat = & reshape( (/1,2,3,4,5,6,7,8,9,10,11,12/), shape(mat)) ! 4 columns by 3 rows integer, dimension(100) :: big ! allocate space for 100 integers double precision, dimension(3) :: av = (/1.5, 2.2, 9.1/) double precision, dimension(5) :: small ! space for 5 doubles double precision, dimension(4,3) :: matrix ! matrix 4 rows of 3 doubles double precision, dimension(0:3,0:2) :: cmat ! different subscript ranges matrix(4,3) = 1.0 ! subscripts start at 1 1,2,3,4 is 4 items normal cmat(3,2) = 2.0 ! subscripts 0,1,2,3 0,1,2 per dimension print *, "exf3.f90 running" print *, "msg=", msg print *, "as(3)=", as(3) print *, "vec(1)=", vec(1) print *, "vec(n)=", vec(n) print *, "mat(4,3) is column major, row minor" print *, "mat(1,1)=", mat(1,1) print *, "mat(1,2)=", mat(1,2) print *, "mat(1,3)=", mat(1,3) print *, "mat(4,1)=", mat(4,1) print *, "mat(4,2)=", mat(4,2) print *, "mat(4,3)=", mat(4,3) print *, "av(3)=", av(3) cmat(0,0) = 1.0 cmat(3,2) = 2.0 print *, "cmac(0,0)=", cmat(0,0) print *, "cmac(3,2)=", cmat(3,2) end program exf3