MODULE typedef
IMPLICIT NONE
TYPE :: tree
INTEGER,ALLOCATABLE :: mat(:)
INTEGER :: a
TYPE(tree),POINTER :: ltree
TYPE(tree),POINTER :: rtree
END TYPE
END MODULE typedef
PROGRAM test
USE typedef
IMPLICIT NONE
TYPE(tree),POINTER :: root => NULL()
TYPE(tree),POINTER :: temp1 => NULL(),temp2 => NULL()
ALLOCATE(root,temp1,temp2)
ALLOCATE(temp1%mat(5),temp2%mat(6))
temp1%mat = 1
temp2%mat = 2
temp1%a = 1
temp2%a = 2
root%ltree => temp1
root%rtree => temp2
END PROGRAM test
L[FEKY~])R9L4%}BKG~~RZQ.png (21.84 KB, 下载次数: 343)
QQ截图20210409084737.jpg (95.14 KB, 下载次数: 368)
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |