Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 6/24/2024
Public

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

Document Table of Contents

Make Substrings Equivalent

When you make one character substring equivalent to another character substring, the EQUIVALENCE statement also sets associations between the other corresponding characters in the character entities; for example:

  CHARACTER NAME*16, ID*9
  EQUIVALENCE(NAME(10:13), ID(2:5))

These statements cause character variables NAME and ID to share space (see the following figure). The arrays can also be aligned by the following statement:

  EQUIVALENCE(NAME(9:9), ID(1:1))
Equivalence of Substrings

If the character substring references are array elements, the EQUIVALENCE statement sets associations between the other corresponding characters in the complete arrays.

Character elements of arrays can overlap at any character position. For example, the following statements cause character arrays FIELDS and STAR to share storage (see the following figure).

  CHARACTER FIELDS(100)*4, STAR(5)*5
  EQUIVALENCE(FIELDS(1)(2:4), STAR(2)(3:5))
Equivalence of Character Arrays

The EQUIVALENCE statement cannot assign the same storage location to two or more substrings that start at different character positions in the same character variable or character array. The EQUIVALENCE statement also cannot assign memory locations in a way that is inconsistent with the normal linear storage of character variables and arrays.