Skip to content

Instantly share code, notes, and snippets.

@guziy
Created February 28, 2019 04:48
Show Gist options
  • Save guziy/0755dadb68188aba2178e5fb999a4581 to your computer and use it in GitHub Desktop.
Save guziy/0755dadb68188aba2178e5fb999a4581 to your computer and use it in GitHub Desktop.
program main
implicit none
interface
subroutine to_be_called(arg, nx, ny, arr)
integer :: arg, nx, ny
integer, allocatable, intent(out) :: arr(:, :)
end subroutine to_be_called
end interface
print *, "Hello"
call caller(5, to_be_called)
end program main
subroutine to_be_called(iarg, nx, ny, arr)
integer :: iarg, nx, ny
integer, allocatable, intent(out) :: arr(:, :)
allocate (arr(nx, ny))
arr = iarg
end subroutine to_be_called
subroutine caller(arg, called)
integer :: arg
interface
subroutine called(arg, nx, ny, arr)
integer :: arg, nx, ny
integer, allocatable, intent(out) :: arr(:, :)
end subroutine called
end interface
integer :: nx, ny
integer, allocatable :: arr(:, :)
nx = 5;
ny = 5;
call called(arg, nx, ny, arr)
print *, size(arr)
print *, arr
end subroutine caller
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment