module 内の subroutine や function に配列を渡すときは、
Fortran は C 言語と同じように、配列名とその大きさをもって、
配列の受け渡しを行うことも可能である。これを
module subpart
implicit none
contains
subroutine dummy_print(e,k)
integer, intent(in) :: k
real(8), intent(in) :: e(0:k-1,0:k-1)
integer i, j
do i = 0, k - 1
write(*,'(100e12.4)') (e(i,j), j = 0, k-1)
end do
end subroutine dummy_print
end module subpart
program explicit
use subpart
implicit none
real(8), allocatable :: e(:,:)
integer :: n = 5
integer i, j
allocate (e(0:n-1,0:n-1))
do i = 0, n - 1
do j = 0, n - 1
if (j == i) then
e(i,j) = 1.0d0
else
e(i,j) = 0.0d0
end if
end do
end do
call dummy_print(e,size(e(1,:)))
end program explicit
大きさがいくつかどうかを調べたくない場合は、size(配列(次元,:)) も使える。