fortran90 - Loop with array inside subroutine -
i have question loop inside subroutine in fortran.
if put subroutine, expect variable test becomes array 1 5.
p.s. type3
defined real, dimension(5,1)
subroutine build(test) type(typelist) :: test = 1, 5 test%type3(i) = end subroutine build
however gives error ;
||error: rank mismatch in array reference (1/2)|
and when remove "(i)" after test%type3, work, result 5.000 5.000 5.000 5.000 5.000. assigns value last loop entries in array. , if remove %test program not know type variable test anymore , gives
||error: unclassifiable statement |
can tell me doing wrong?
did forget assign test%type3(i,1) = i
?
since type3
2d array, need 2 indices assign values. when type test%type3 = i
assigning all elements @ same time same value. why in end 5.0
.
ps. enddo
statement?
Comments
Post a Comment