參考連接: Fortran-數組html
program main數組
integer a(3,3)ide
integer ,allocatable :: arr_out(:,:)spa
data a /1,2,0,3,4,0,0,0,0/orm
integer src_size, desc_sizehtm
write(*,*) 'src_arr', aget
src_size=3it
desc_size=2table
allocate(arr_out (desc_size, desc_size))class
call resize_array(a,src_size, arr_out, desc_size)
write(*,*) "arr_out", arr_out
deallocate(arr_out)
end
subroutine resize_array(src_arr,src_size, desc_arr , desc_size)
integer src_size,desc_size
integer desc_arr(desc_size,desc_size)
integer src_arr(src_size,src_size)
do i=1,desc_size
do j=1,desc_size
desc_arr (i,j) = src_arr(i,j)
end do
end do
end subroutine