In a program I have an allocatable array but I would like to allocate it in a subroutine. I tried by using a module and by an interface statement, but the compiler always returns an error ('a dummy argument cannot be allocatable').
This is a minimal code to reproduce my problem:
subroutine alloca(aaa)
real, allocatable, intent(inout):: aaa(:,:)
allocate(aaa(5,5))
aaa(1,1) = 4.5
end subroutine alloca
program prova
interface
subroutine alloca(aaa)
real, allocatable, intent(inout):: aaa(:,:)
end subroutine alloca
end interface
real, allocatable:: bbb(:,:)
call alloca(bbb)
write(*,*) bbb(1,1)
end program prova
Where am I wrong?