passing dynamic arrays to subroutines in MS Fortran 
Author Message
 passing dynamic arrays to subroutines in MS Fortran

        I am using MS fortran Version 5.1 and I am trying to define an
allocatable array and then pass the array to a subroutine but it is not working.
If the array is defined as allocatable and is allocated and then passed to the
subroutine were it is defined again as allocateable an error occures telling
me that '[ALLOCATABLE]' is not valid for the array.  If I pass the array to the
subroutine and define it with the * the values are lost.
ie.
integer matrix[allocatable] (:),size
read (*,*) size
allocate (matrix(size))
        do 10 i=1,size
         maxtrix(i)=i
10      print *, matrix(i)
        print *, ' '
        call alltest(maxtrix,size)
        stop
        end
c
        subroutine alltest(matrix,size)
        integer matrix(*),size
        do 10 i=1,size
 10      print *,matrix(size)
        return
        end

OUTPUT:
1
2
3
4
5
6

0
0
0
0
0
0

If anyone has any ideas please let me know

///MiStEr pEaCh\\\



Sun, 08 Oct 1995 21:13:33 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Newbie: passing dynamic array in Subroutine

2. Passing arrays to subroutines in fortran 90

3. passing pointer based arrays to subroutines in fortran

4. Passing Dynamic Arrays to Fortran From VB

5. Passing logical variables from Fortran subroutine to C subroutine

6. Passing arrays from VB5 to MS FORTRAN PwrStn

7. [Q: Dynamic arrays in calling of subroutines]

8. Passing bidimensional array to subroutine

9. Passing Array to a subroutine

10. Passing array of derived data types to a subroutine

11. Passing arrays to subroutine

12. Passing array element to subroutine

 

 
Powered by phpBB® Forum Software