我有一個模塊,其中包含一個子程序,而該子程序又包含一個函數。我在我的主程序中說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