Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Passing info about an array

$
0
0

I treied using both DIM and LEN to pass information about an array I input

to a subroutine. For example:

REAL  A(-23:35)

CALL SUB1(A)

Do I explicititly have to tell it how big the array is in a separate

item in the call sequence? In this case, A has 59 elements,

(35-(-23)+1) so would I have to say:

REAL A(-23:35)

CALL SUB1(59,A)

SUBROUTINE SUB1(NA,A)

REAL  A(1:NA)

INTEGER NA

---------------------------------------------------------------------------------------

I thought that the newest Fotran has a way to provide all that info

just by passing the array name.

 

Maybe there is an article about this somewhere?

I could not find it.

Does the subroutine have a way of knowing the upper and limits of

the array for boundary checking, to prevent storing information

outside its bounds? Otherwise you could get some nasty hard to find bugs.


Viewing all articles
Browse latest Browse all 5691


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>