次のように配列を初期化しようとしています。
program test
n = 3
call it(n)
contains
subroutine it(n)
integer n,j
integer, dimension(3*(n-1)) :: a=(/(j,j=4,3*n,1)/)
write(*,*) a
end subroutine it
end program test
でコンパイルするとgfortran -o test.exe test.f
、次のエラーが表示されます。
test.f:9.43:
integer, dimension(3*(n-1)) :: a=(/(j,j=4,3*n,1)/)
1
Error: Invalid character in name at (1)
何が問題ですか?私の知る限り、これは標準準拠のコードです。