Functions can return arrays, for example,
PROGRAM Maian IMPLICIT NONE INTEGER, PARAMETER :: m = 6 INTEGER, DIMENSION(M,M) :: im1, im2 ... IM2 = funnie(IM1,1) ! invoke CONTAINS FUNCTION funnie(ima,scal) INTEGER, INTENT(IN) :: ima(:,:) INTEGER, INTENT(IN) :: scal INTEGER, DIMENSION(SIZE(ima,1),SIZE(ima,2)) & :: funnie funnie(:,:) = ima(:,:)*scal END FUNCTION funnie END PROGRAM
Note how the DIMENSION attribute cannot appear in the function header.
For more information, click here