Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Understanding of Declaration

Arnie_L_
Beginner
479 Views

Hi friends,

My co. has given me a task of learning Fortran as we want to upgrade some of our models. While studying the code I cam across the foll statements and not able to understand what exactly is the meaning of it.

INTEGER Z
PARAMETER (Z = 5)

LOGICAL X(Z)
REAL*8 Y(Z)


LOGICAL A,B,C,D
COMMON /DEC/ A,B,C,D

Please help me as I am new to fortran.

Thanks in advance

0 Kudos
1 Reply
Heinz_B_Intel
Employee
479 Views

Hi Arnie

using the  constant value ("PARAMETER")  Z=5,  you are  defining  an

- array of 5 logical ( "boolean" ) objects X(1), ... X(5)

- an array  of 5 double precision (64 bit) floating point objects  Y(1) ... Y(5)

- 4 scalar logical variables you map to a named ( name is "DEC")  COMMON BLOCK. The COMMON BLOCK ( and thus these 4 variables) can be accessed by other subroutines  too without passing them as arguments - thus some kind of global variables in Fortran. .

There is a lot of nice material available on the WEB to introduce you to Fortran like tutorials etc. You might want to search for it to find more about COMMON BLOCKs etc

0 Kudos
Reply