Derived Datatypes
Data objects can be arranged into structures. These structures can consist of scalar variables, arrays, or even sub-structures. In Fortran, a structure of this sort is called a derived datatype and is very similar to the structs in C. A simple example looks like this:
The components of a structure are accessed through the name of the structure followed by a percent (%
) sign and the name of the component. Example:
A structure can be assigned in one self-contained statement:
Arrays of structures are manipulated like this: