r-aa (r_aa) wrote,
r-aa
r_aa

Указатель на функцию в фортране

module module_act
implicit none

contains

integer function act(f, a, b)
implicit none
integer, intent(in) :: a, b
interface
    integer function f(x, y)
    integer, intent(in) :: x, y
    end function f
end interface

    act = f(a, b)

end function act

end module module_act

program pr
use module_act
implicit none
interface
    integer function add(a, b)
    integer, intent(in) :: a, b
    end function add
end interface

    print *, "res = ", act(add, 1, 2)

end program pr

integer function add(a, b)
implicit none
integer, intent(in) :: a, b

    add = a + b

end function add
Tags: fortran, it, программирование, шпаргалки
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments