Consider the following subroutine
subroutine myProc(m,n,flag,X)
Integer, intent(in) :: m,n
logical, intent(in) :: flag
real(8), intent(out), allocatable :: X(:,:)
if (flag) then
allocate(X(m,n))
! some more code here
else
allocate(X(m-1,n))
! some more code here
end if
end subroutine myProc
!!!!!!!!!!!!!!!!!!!
Also, how do I call this procedure in a program? suppose I write
!... some code before
call myProc(5,6,.TRUE.,X)
Do I need to define X already as a (4,6) real array or pass an allocatable array to the subroutine?
Is doing all of that even possible in Fortran 95?