我有一个模块,其中包含一个子程序,而该子程序又包含一个函数。我在我的主程序中说use themodule
,我可以call thesubroutine
,但是如何访问子程序中包含的函数?如何调用模块中子例程的内部函数?
的代码看起来是这样的:
module useful
integer, parameter :: N=2
double precision, parameter :: xmin=1, xmax=10, pi=3.1415926535898
double complex :: green(N,N), solution(N), k=(2.0,0.0)
contains
subroutine y(n1)
contains
function x(n1)
real :: n1, x
x=n1*(xmax-xmin)/N
end function x
end subroutine y
end module useful