LF Fortran 95

Derived Type Component References

Components of a structure are referenced using the percent sign `%' operator. For example, latitude in the structure my_coordinates, above, is referenced as my_coordinates%latitude. latitude in type coordinates in structure my_town is referenced as my_town%coordinates%latitude. If the variable is an array of structures, as in cities, above, array sections can be referenced, such as

cities(:,:)%name

which references the component name for all elements of cities, and

cities(1,1:2)%coordinates%latitude

which references element latitude of type coordinates for elements (1,1) and (1,2) only of cities. Note that in the first example, the syntax

cities%name

is equivalent and is an array section.