This is an old revision of the document!
module HelloWorld
procedure(), pointer :: ptr
contains
subroutine Hello1()
print *,'Ahoj'
end subroutine
subroutine Hello2(a)
integer, intent(in) :: a
print *,'Nazdar',a
end subroutine
end module
program main
use HelloWorld
implicit none
ptr => Hello1
call ptr
ptr => Hello2
call ptr(2)
end program
zdenka@pc209:~/simulations/fireball/ptr_func$ ifort -c main.f90 -o main.o;ifort main.o -o test;./test Ahoj Nazdar 2
module HelloWorld
procedure(Hello1), pointer :: ptr
contains
subroutine Hello1(a,b)
integer, intent(in) :: a
real, intent(in) :: b
print *,'Ahoj',a,b
end subroutine
subroutine Hello2(a,b)
integer, intent(in) :: a
real, intent(in) :: b
print *,'Nazdar',a,b
end subroutine
end module
program main
use HelloWorld
ptr => Hello1
call ptr(1,1.0)
ptr => Hello2
call ptr(2,2.0)
end program