# 3 Data Types, Constants, and Variables

Each constant, variable, array, expression, or function reference in a Fortran statement has a data type. The data type of these items can be inherent in their construction, implied by convention, or explicitly declared.

Each data type has the following properties:

- A name

  The names of the intrinsic data types are predefined, while the names of derived types are defined in derived-type definitions. Data objects (constants, variables, or parts of constants or variables) are declared using the name of the data type.

- A set of associated values

  Each data type has a set of valid values. Integer and real data types have a range of valid values. Complex and derived types have sets of values that are combinations of the values of their individual components.

- A way to represent constant values for the data type

  A constant is a data object with a fixed value that cannot be changed during program execution. The value of a constant can be a numeric value, a logical value, or a character string.

  A constant that does not have a name is a literal constant. A literal constant must be of intrinsic type and it cannot be array-valued.

  A constant that has a name is a named constant. A named constant can be of any type, including derived type, and it can be array-valued. A named constant has the PARAMETER attribute and is specified in a type declaration statement or PARAMETER statement.

- A set of operations to manipulate and interpret these values

  The data type of a variable determines the operations that can be used to manipulate it. Besides intrinsic operators and operations, you can also define operators and operations.

This chapter contains information on the following topics:

- Intrinsic data types and constants (Section 3.1)
- Derived data types (Section 3.2)
- Binary, octal, hexadecimal, and Hollerith constants (Section 3.3)
- Variables, including arrays (Section 3.4)

For More Information:

- On type declaration statements, see Section 5.1.
- On valid operations for data types, see Section 4.1.
- On defined operations, see Section 4.1.5.
- On ranges for numeric literal constants, see your user manual or programmer's guide.
- On named constants, see Section 5.14.
- On the PARAMETER attribute and statement, see Section 5.14.

Previous Page Next Page Table of Contents