Fortran 90

7. INTENT Attributes
An INTENT attribute or statement describes the intended use of an argument in a subroutine or function. It can reduce unnecessary internal copying if:
  • array arguments are not altered in a routine
  • initial values are not read
Another important benefit is that the compiler can spot instances where variables are being used in a way other than what was intended, e.g. it can verify that all the INTENT(IN) variables are not having their values changed within the routine.
 SUBROUTINE neuron(a,b,c,m,n)
 REAL, DIMENSION(n,n), INTENT(IN) :: a
 REAL, DIMENSION(m,m) :: b,c 
 INTENT(out) :: b 
 INTENT(inout) :: c 
 c = SQRT(c) 
 b = c + SUM(a) 
 END
Must use an INTERFACE block in the above case