24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Functions and Subroutines<br />

has no type and must be associated with an asterisk. Arguments can be passed through more than one level<br />

of procedure reference. In this case, valid association must exist at all intermediate levels as well as the last<br />

level. Argument association is terminated upon the execution of a RETURN or END statement.<br />

12.8.3.1 Length of Character Actual and Dummy Arguments<br />

If a dummy argument is of type CHARACTER, the corresponding actual argument must also be of type<br />

CHARACTER and the length of the dummy argument must be less than or equal to the length of the actual<br />

argument. If the length of the dummy argument is len then the len leftmost characters of the actual<br />

argument are associated with the dummy argument.<br />

If a dummy argument of type CHARACTER is an array name, then the restriction on the length is on the<br />

whole array and not for each array element. The length of an array element of the dummy argument may<br />

be different from the length of the array element of the corresponding actual array, array element, or array<br />

element substring, but the dummy array argument must not extend beyond the end of the associated actual<br />

array.<br />

12.8.3.2 Variables as Dummy Arguments<br />

A dummy argument that is a variable may be associated with an actual argument that is a variable, array<br />

element, substring or expression. Only if the actual argument is a variable, array element or substring can<br />

the corresponding actual argument be redefined.<br />

12.8.3.3 Arrays as Dummy Arguments<br />

A dummy argument that is an array may be associated with an actual argument that is an array, array<br />

element or array element substring. The number and size of the dimensions in the actual argument array<br />

declarator may be different from the number and size of the dimensions in the dummy argument array<br />

declarator.<br />

If the actual argument is a non-character array name, then the size of the dummy argument array must not<br />

exceed the size of the actual argument array. An element of the actual array becomes associated with the<br />

element in the dummy array with the same subscript value. Association by array element of character<br />

arrays exists only if the lengths of the array elements are the same. If their lengths are not the same, the<br />

dummy and actual array elements will not consist of the same characters.<br />

If the actual argument is a non-character array element name whose subscript value is asv the size of the<br />

dummy argument array must not exceed the size of the actual argument array less asv - 1. Furthermore, the<br />

dummy argument array element whose subscript value is dsv becomes associated with the actual argument<br />

array element whose subscript value is asv + dsv - 1. Consider the following example.<br />

Subprogram Arguments 279

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!