ex0822.f90

来自「fortran 95书的源程序全集」· F90 代码 · 共 25 行

F90
25
字号
program ex0822
  implicit none
  external sub1, sub2 ! 声明sub1跟sub2是子程序名称
  call sub(sub1)      ! 把子程序sub1当参数传出去
  call sub(sub2)      ! 把子程序sub1当参数传出去
  stop
end program

subroutine sub(sub_name)
  implicit none
  external sub_name ! 声明sub_name是个子程序
  call sub_name()   ! 调用传入的子程序sub_name
  return
end subroutine

subroutine sub1()
  implicit none
  write(*,*) "sub1"
end subroutine

subroutine sub2()
  implicit none
  write(*,*) "sub2"
end subroutine

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?