F90 allows pointers to derived types
type(DP_Complex), target :: a type(DP_Complex), pointer :: Ptr_a Ptr_a => a
Derived types may contain pointer components
type Student integer :: id character,dimension(:),pointer :: name end type StudentWhen the derived type contains pointer components, the structure asignment works as follows. Consider the code sequence
type(Student) :: stud1, stud2 stud1 = stud2The meaning is that
stud1%id = stud2%id ! copy stud1%name => stud2%name ! pointer assignmentAlthough it is not possible to have ALLOCATABLE arrays as components of derived types, we can still work with student names of different lengths using pointer components. Here the component name is a pointer to a dynamically sized 1-D array of characters. We use it as follows:
type(Student) :: leader leader%id = 1234 allocate(leader%name(8)) leader%name = (/"J","o","h","n"," ","D","o","e"/)