torstenSchrobe
Technical User
Hi Guys,
I'm a beginner in fortran programming and don't speak english so well, but i hope you will undersand my question
In the program there is an allocatable array, which shall be allocated in the subroutine, and then given back to the main program (beacause in the subroutine i read in the data and get to know how big the array must become). When i try to allocate the array in the subroutine i get a "Segmentation fault".
What can i do to avoid this? Maybe with a pointer on the array?
Please help me!
Here is the simplified example:
double precision,allocatable,dimension):: array
call readData(array)
subroutine readData(array)
double precision,allocatable,dimension):: array
allocate(array(2))
end subroutine readData
I'm a beginner in fortran programming and don't speak english so well, but i hope you will undersand my question
In the program there is an allocatable array, which shall be allocated in the subroutine, and then given back to the main program (beacause in the subroutine i read in the data and get to know how big the array must become). When i try to allocate the array in the subroutine i get a "Segmentation fault".
What can i do to avoid this? Maybe with a pointer on the array?
Please help me!
Here is the simplified example:
double precision,allocatable,dimension):: array
call readData(array)
subroutine readData(array)
double precision,allocatable,dimension):: array
allocate(array(2))
end subroutine readData