我正在尝试按如下方式初始化数组:
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)
问题是什么?据我了解,这是符合标准的代码。