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

Passing allocatable array to a subroutine

$
0
0

I'm trying to pass an allocatable array, which is already allocated, to a subroutine. something like this:

real(8), dimension(:,:), allocatable :: A

allocate (A (6,6))

call subroutine mysub(A)



subroutine mysub(B)
real (8), dimension (:,:) :: B

write (*,*) B(1,1)

This causes segmentation fault when mysub is accessing B. I have had the same approach to pass the array to a function and it worked fine. I wonder what's going wrong here. 

Thanks,

Alireza


Viewing all articles
Browse latest Browse all 5691

Trending Articles



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