Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Fortran 90 Programmer's Reference: HP Fortran 90 Programmer's Reference > Chapter 10 HP Fortran 90 statements

TYPE (definition)

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

The first statement of a derived type definition.

Syntax

TYPE [[, access-spec ] ::] derived-type-name
access-spec

is the keyword PUBLIC or PRIVATE.

derived-type-name

is a legal Fortran 90 name.

Description

The TYPE statement introduces the definition of a derived type. A derived type name may be any legal Fortran 90 name, as long as it is not the same as an intrinsic type name or another local name (except component names and actual argument keyword names) in that scoping unit.

A derived type may contain an access specification (PUBLIC or PRIVATE attribute) or an internal PRIVATE statement only if it is in a module.

Examples

! This is a simple example of a derived type
! with two components, high and low.
TYPE temp_range
INTEGER high, low
END TYPE temp_range

! This type uses the previous definition for one of its
! components
TYPE temp_record
CHARACTER(LEN=40) city
TYPE (temp_range) extremes(1950:2050)
END TYPE temp_record
! This type has a pointer component to provide links to other
! objects of the same type, thus providing linked lists.
TYPE linked_list
REAL value
TYPE(linked_list),POINTER :: next
END TYPE linked_list
! This is a public type whose components are private; defined
! operations provide all functionality.
TYPE, PUBLIC :: set; PRIVATE
INTEGER cardinality
INTEGER element ( max_set_size )
END TYPE set
! Declare scalar and array of type set.
TYPE (set) :: baker, fox(1:size(hh))

Related statements

INTERFACE, PRIVATE, PUBLIC, SEQUENCE, and TYPE (declaration)

Related concepts

For information about derived types, see “Derived types”.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.