home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / fortran / 4238 < prev    next >
Encoding:
Text File  |  1992-11-08  |  2.1 KB  |  56 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!nih-csl.dcrt.nih.gov!helix.nih.gov!rvenable
  3. From: rvenable@helix.nih.gov (Richard M. Venable)
  4. Subject: Re: Dimensioning arrays passed in a parameter list.
  5. Message-ID: <1992Nov8.021607.16636@alw.nih.gov>
  6. Sender: postman@alw.nih.gov (AMDS Postmaster)
  7. Organization: National Institutes of Health, Bethesda
  8. References: <1992Nov7.160034.6836@netcom.com>
  9. Date: Sun, 8 Nov 1992 02:16:07 GMT
  10. Lines: 44
  11.  
  12. In article <1992Nov7.160034.6836@netcom.com> jchauvin@netcom.com (John H. Chauvin) writes:
  13. >
  14. >I am currently porting a FORTRAN 66 program from an IBM 3090 to a Silicon 
  15. >Graphics workstation. Can someone tell me the correct FORTRAN 77 procedure 
  16. >for dimensioning arrays passed in a call parameter list: For example:
  17. >
  18. >.                DIMENSION A(50),B(50)
  19. >                                     .
  20. >                                     .
  21. >                                     .
  22. >                                     .
  23. >                CALL XYZ(A,B)
  24. >                                     .
  25. >                                     .
  26. >
  27. >                 SUBROUTINE XYZ(A,B)
  28. >                 DIMENSION A(1),B(1)            <====== Is this correct?
  29. >                 DIMENSION A(*),B(*)             <====== Or Is this right?
  30. >                                     .
  31. >                                     .
  32. >
  33. >
  34. >How do I handle passing two or three dimensional arrays? (A(1,1,1)  or A(*,*,*)?)
  35.  
  36. Most implementations I've seen support using the '*', but only for the last
  37. dimension.  Another way to deal with that problem is to pass the dimensions
  38. of array arguments as additional arguments:
  39.  
  40.     CALL XYZ(N,A,B)
  41.         :
  42.         :
  43.     SUBROUTINE XYZ(N,A,B)
  44.     DIMENSION A(N,*), B(N)
  45.  
  46. Note that only arrays passed as arguments may be dimensioned in this way, and
  47. not other arrays in the subroutine.
  48.  
  49.  
  50. <---------------------------------------------------------------------->
  51. <  Rick Venable                (O O) |  "Back off, I'm a scientist."   >
  52. <  FDA/CBER Biophysics Lab      )|(  |        -- Bill Murray in        >
  53. <  rvenable@helix.nih.gov       (=)  |           'Ghostbusters'        >
  54. <---------------------------------------------------------------------->
  55.  
  56.