Fortran是否可以在subroutine 中调用function

ScienceSoft 编程软件评论阅读模式

fortran是否可以在subroutine 中调用function?

答案是可以的:

real function add(a,b)

implicit none

real::a,b

add=a+b

return

end

subroutine total(c)

implicit none

real::a,b,c

real,external::add !声时add是一个函数而不是变量

a=1.0

b=2.0

c=add(a,b) !直接调用add就可以返回了

return

end

via fortran是否可以在subroutine 中调用function_百度知道.

weinxin
我的微信公众号
分享科研软件、科研方法,为你的科研助力。
ScienceSoft
  • 本文由 发表于 28 3 月, 2015 04:02:52
  • 转载请务必保留本文链接:https://www.sciencesoft.cn/fortran-call-function-in-subroutine/
评论  0  访客  0
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定