Developer Guide and Reference

ID 767251
Date 10/31/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Declarations for Other Nonintrinsic Types

You can also make enum type declarations.

Interoperable Enumerators and ENUM Types

An interoperable enumeration is a set of enumerators, which optionally can have an enum type name. Enum types are interoperable with C enumeration types. An enum type is a nonintrinsic type that has no type parameter and is not a derived type.

Example

The following are examples of interoperable enumerator types:

  ENUM,BIND(C) 
    ENUMERATOR :: one=1, two, three=3
    ENUMERATOR :: four, seven=7
  END ENUM

The above example declares five named constants, similar to the declaration:

  INTEGER,PARAMETER :: one=1, two=2, three=3, four=4, seven=7