type::string
character(len=:),allocatable::str
end type
type(string)::a(4)
a(1)%str="hi"
character(len=:),allocatable::str(4)
program Test
implicit none
character(:),allocatable:: str(:)
allocate(str,source=['abc','12345'])
print*,len(str(1)), str(1)
print*,len(str(2)), str(2)
end program
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |