MOVE_ALLOC

9.193 MOVE_ALLOC — Move allocation from one object to another

Description:
MOVE_ALLOC(FROM, TO) moves the allocation from FROM to TO. FROM will become deallocated in the process.
Standard:
Fortran 2003 and later
Class:
Pure subroutine
Syntax:
CALL MOVE_ALLOC(FROM, TO)
Arguments:
FROM ALLOCATABLE, INTENT(INOUT), may be of any type and kind.
TO ALLOCATABLE, INTENT(OUT), shall be of the same type, kind and rank as FROM.
Return value:
None
Example:
program test_move_alloc
    integer, allocatable :: a(:), b(:)

    allocate(a(3))
    a = [ 1, 2, 3 ]
    call move_alloc(a, b)
    print *, allocated(a), allocated(b)
    print *, b
end program test_move_alloc

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-5.4.0/gfortran/MOVE_005fALLOC.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部