A pointer in computer programming is an object that refers to a memory address. In Fortran it is declared with the keyword pointer in its declaration. Additionaly its assignment is done with the => keyword.

However, in order to have an array of pointers use the following form must be used:

type(objectContainer), allocatable :: some(:)    
...    
type objectContainer      
  class(object), pointer :: toObj     
end type

Do not fall into the mistake to use the form below as it is a pointer to an array:

class(object), pointer :: some(:)    

nor

type(object), pointer :: some(:)

Leave a Reply

Your email address will not be published. Required fields are marked *