Definition of variables

After the declaration of variables, your computer knows how much space is to be allocated for each variable, but the actual value of this variable is not known. Although some F77 compilers implicitly assign each declared variable a zero value or an empty string (for character types), I strongly advise you not to count on it!

Definition of a variable is the same as assigning it a value. Assume that we have already declared integer count, real result, logical flag, character*10 univ. The definition of these variables occurs always after their declaration by assigning them their actual values:

      count = 0
      result = 5.3
      flag = .false.
      univ = 'upenn'
These statements store zero in count, 5.3 in result, logical value 0 (.false.) in flag and the string upenn in variable univ. Similar statements can also be used to define variables of other data types.



Roman Gröger (2015-09-23)