yu_ominae
yu_ominae

Reputation: 2935

Fortran variable type conversion

Quick question. I have a fortran77 subroutine with a variable declaration

DIMENSIONS HH(13, 1000)

I assume that since no type is specified, this variable is an array of integers. Later in the programme I have a loop in which there is the following line:

HH(2,N) = HH(4,N) + W2

W2 is not explicitly declared in the subroutine, nor is it passed as an argument. I assume that it is types by default as a real variable.

I guess that for the above command, W2 is converted to an integer before it is added to HH(4,N). Is this correct?

Apologies if this is really basic.

Upvotes: 0

Views: 886

Answers (1)

talonmies
talonmies

Reputation: 72372

In Fortran 77, variables starting with I, J, K, L, M, or N are implicitly INTEGER unless defined otherwise. All other variables are implicitly REAL. This implies your array HH is REAL. So the result

HH(2,N) = HH(4,N) + W2

will be REAL with no implicit casting involved.

Upvotes: 2

Related Questions