| 本帖最后由 vvt 于 2015-5-8 15:44 编辑 
 1. 对于可分配数组,如果已经分配,则可以当做普通数组变量传递。(虚参无需声明为allocatable)
 2. 如果尚未分配就传递,这需要把虚参声明为 allocatable。
 3. 对第二条的情况,Fortran95 以前不支持。只有 Fortran2003 和 2008 才支持。
 4. 对第二条的情况。必须有 interface,或使用 module,或使用 contains 来避免书写 interface 。
 
 
 [Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode program www_fcode_cn
  real , allocatable :: a(:)
  call sub(a)
  write(*,*) a
contains
subroutine sub(x)
  real , allocatable ::x(:)
  allocate(x(3))
  x = 111.0
end subroutine sub
end program www_fcode_cn
 
 
 
 |