MOVE_ALLOC — Move allocation from one object to another#
-
MOVE_ALLOC(FROM, TO)#
MOVE_ALLOC(FROM, TO)moves the allocation fromFROMtoTO.FROMwill become deallocated in the process.- Parameters
FROM –
ALLOCATABLE,INTENT(INOUT), may be of any type and kind.TO –
ALLOCATABLE,INTENT(OUT), shall be of the same type, kind and rank asFROM.
- Returns
None
- Standard:
Fortran 2003 and later
- Class:
Pure subroutine
- Syntax:
CALL MOVE_ALLOC(FROM, TO)
- 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