This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

help please


Dear Sir/Madam:

I am trying to figure out how to pass an array to a subroutine to write results to a file. My program is just for testing and it does not work. If I remove the open file and subroutine parts, it works fine to output on the screen. The attachment is my program. Please help me to fix it.

Your help is greatly appreciated!

Sincerely,

Ming

 



Do You Yahoo!?
New! SBC Yahoo! Dial - 1st Month Free & unlimited access
*program passing array to a subroutine

        integer i, j
        dimension k(2,15)
        OPEN(UNIT=3,FILE='SUB.DAT',STATUS='NEW')

        do 1 j=1,2
           do 5 i=1,15
              k(j,i)=i
5          continue
1       continue
           call printout(k)
        stop
        end

        subroutine printout(l)
        dimension l(2,15),M(2,15)
        do 15 i=1,2
           DO 8 J=1,15
              M(I,J)=L(I,J)*I
8          CONTINUE
        WRITE(3,100) i, (M(i,J), j=1,15)
100     FORMAT(16(I3))
        print *, i, (M(i,J), j=1,15)
15      continue
        return
        stop
        end
             



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]