How to initialize two-dimensional arrays in Fortran
You can do that using reshape and shape intrinsics. Something like: INTEGER, DIMENSION(3, 3) :: array array = reshape((/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), shape(array)) But remember the column-major order. The array will be 1 4 7 2 5 8 3 6 9 after reshaping. So to get: 1 2 …