标签: fortran90
假设我有这个子程序:
subroutine a () integer, pointer :: b allocate(b) end subroutine a
变量b位于子程序的堆栈上,因此一旦程序从子程序返回就会被销毁。但它指向的目标呢?据我所知,通过阅读F90标准,目标是不解除分配,但我找不到明确说明的明确声明。
b
答案 0 :(得分:1)
简短的回答是否。您有责任致电deallocate(b),就像您有责任首先致电allocate(b(100))一样。
deallocate(b)
allocate(b(100))