Dears,
I have a strange problem which I do not understand what is it.
Based on pointers definition the simple code which I wrote below should work, but it does not please help me.
the subroutine can not deallocate the pointer which according to text book should be the case
please help me in this regard.
cheers,
I have a strange problem which I do not understand what is it.
Based on pointers definition the simple code which I wrote below should work, but it does not please help me.
Code:
module all
contains
subroutine deall(a)
integer, pointer :: a
integer, pointer :: curr => null()
curr => a
if (associated(curr)) then
deallocate(curr)
nullify(curr)
endif
end subroutine deall
end module
program test
use all
implicit none
integer, pointer :: a=>null()
integer, pointer :: b=>null()
allocate(a)
a=10
print*,associated(a)
call deall(a)
print*,associated(a)
End Program test
the subroutine can not deallocate the pointer which according to text book should be the case
please help me in this regard.
cheers,