Created
February 28, 2019 04:48
-
-
Save guziy/0755dadb68188aba2178e5fb999a4581 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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