小编Alb*_*oni的帖子

动态数组 f95

我想了解如何在 f95 中使用动态内存。

我知道 f2003 中的以下代码有效。

program main
        use pippo
              implicit none
              integer, allocatable :: arr(:)
              call createDynamic(arr)

end program main

module pippo
      contains
              subroutine createDynamic(arr)
                        implicit none
                        integer, allocatable,dimension(:)::arr
                        integer :: i,n
                        n=10
                        allocate(arr(n))
                        do i=1,n
                                arr(i) = i
                        end do
                end subroutine createDynamic

end module pippo

Run Code Online (Sandbox Code Playgroud)

我想在 f95 中编写一个版本:正确的方法是什么?

fortran

0
推荐指数
1
解决办法
64
查看次数

标签 统计

fortran ×1