ptr=>fun(n) !!!!!!!!!!!!!!!!
write(*, *) associated(ptr), ptr ! The result is T
call sub(n, ptr)
write(*, *) associated(ptr), ptr ! The result is T
With the function version, ptr's pointer association status does not become
associated because that happens only by associating it with a target,
allocating it, or nullifying it, none of which you do. The version above
works. In the subroutine version, ptr gets allocated in the subroutine.
Hope that helps, and a Merry Christmas to all our readers,
Mike Metcalf
|