<MOVE_ALLOC Example Program>
Program move_alloc_example
Character(:),Allocatable :: a(:), tmp(:)
a = [ 'Hello','World' ]
Print *, 'A has shape', Shape(a), 'length', Len(a), 'and value ', a
Allocate(Character(6)::tmp(4))
tmp(1) = 'First:'
tmp(2:3) = a
tmp(4) = ':Last!'
Call Move_Alloc(tmp, a)
Print *, 'A now has shape', Shape(a), 'length', Len(a), 'and value ', a
End Program
■ Execution Results
A has shape 2 length 5 and value HelloWorld
A now has shape 4 length 6 and value First:Hello World :Last!