R.Merritt
R.Merritt

Reputation: 477

Fortran 77 and passing an array to a subroutine

I have the following code :

parameter (maxprt=25)
dimension pt(maxprt)
impt  = maxprt

call rdprob(delt,denr,denw,ders,des,ecapr,ecapw,ein,erb0,erock,ext,iflim,ifmax,ifseg,ilim,ilpt,impt,iout,irlim,ismax,itstep,maxrk,pt,qexto,qfrac,qin,qnxt,qtot,rockr,rockv,t0,te0,tend,ter0,tstart,vol,xin,xs,ir1)

subroutine rdprob(delt,denr,denw,ders,des,ecapr,ecapw,ein,erb0,erock,ext,iflim,ifmax,ifseg,ilim,ilpt,impt,iout,irlim,ismox,itstep,maxrk,pt(25),qexto,qfrac,qin,qnxt,qtot,rockr,rockv,t0,te0,tend,ter0,tstart,vol,xin,xs,ir1)

when i go to compile link i get indicating pt is a problem

borehole.for: In program `MAIN__':
borehole.for:111: 
   call rdprob(delt,denr,denw,ders,des,ecapr,ecapw,ein,erb0,erock,ext,iflim,ifmax,ifseg,ilim,ilpt,impt,iout,irlim,ismax,itstep,maxrk,pt
                                                                                                                                     ^
Expression at (^) has incorrect data type or rank for its context

any ideas on how to fix this or properly call a subroutine while passing an array

Upvotes: 1

Views: 1061

Answers (1)

John Alexiou
John Alexiou

Reputation: 29244

This is how you declare an array argument:

parameter (maxprt=25)
dimension pt(maxprt)

call test(pt)

and somewhere else

subroutine test(a)
dimension a(25)

end subroutine

Upvotes: 1

Related Questions