- #1
fortrannewbe
- 3
- 0
Hi,
i have some problems to return a array or vector from a function that is located in a fortran-module. If i put the function inside the main program block with a "contains" it works, but why does the following not work? Does anyone have an idea?
Thanks
i have some problems to return a array or vector from a function that is located in a fortran-module. If i put the function inside the main program block with a "contains" it works, but why does the following not work? Does anyone have an idea?
Thanks
Code:
module testmodule
contains
function testfunction(a)
real, dimension(3) :: testfunction
real :: a
testfunction(1) = a + 10
testfunction(2) = a + 20
testfunction(3) = a + 30
end function testfunction
end module testmodule
program testprogram
use testmodule
real :: b = 15
print*, testfunction(b)
end program testprogram