allocate.f90

来自「Mac OS X 10.4.9 for x86 Source Code gcc」· F90 代码 · 共 39 行

F90
39
字号
! Test allocation and deallocation.program test_allocate  call t1 (.true.)  call t1 (.false.)  call t2contains! Implicit deallocation and saved aloocated variables.subroutine t1(first)  real, allocatable, save :: p(:)  real, allocatable :: q(:)  logical first  if (first) then    if (allocated (p)) call abort ()  else    if (.not. allocated (p)) call abort ()  end if  if (allocated (q)) call abort ()  if (first) then    allocate (p(5))  else    deallocate (p)  end if  allocate (q(5))end subroutine! Explicit deallocation.subroutine t2()  real, allocatable :: r(:)  allocate (r(5))  pr = 1.0  deallocate (r)  if (allocated(r)) call abort ()end subroutineend program

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?