home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / fortran / 4380 < prev    next >
Encoding:
Text File  |  1992-11-20  |  1.2 KB  |  38 lines

  1. Path: sparky!uunet!timbuk.cray.com!shamash!ems!ems.cdc.com!mstemper
  2. From: mstemper@ems.cdc.com (Michael Stemper)
  3. Newsgroups: comp.lang.fortran
  4. Subject: Re: passing a string constant to a subroutine
  5. Message-ID: <30529@nntp_server.ems.cdc.com>
  6. Date: 20 Nov 92 15:14:27 GMT
  7. References: <EJH.92Nov19160031@khonshu.colorado.edu>
  8. Sender: sys@ems.ems.cdc.com
  9. Reply-To: mstemper@ems.cdc.com
  10. Organization: Empros Systems International, a division of Ceridian
  11. Lines: 24
  12. Nntp-Posting-Host: kirk.ems.cdc.com
  13.  
  14. In article <EJH.92Nov19160031@khonshu.colorado.edu>, ejh@khonshu.colorado.edu (Edward J. Hartnett) writes:
  15. >When I want to pass a string constant to a subroutine, what size do I
  16. >declare the character variable to be in the subprogram. For example
  17. >I have a subroutine:
  18. >
  19. >      subroutine ask_data_type(prog, typenum)
  20. >
  21. >This is intended to be called from one of several programs, and the
  22. >program name is to be passed in as the first parameter. Inside the
  23. >subroutine I have:
  24. >      character*20 prog
  25.  
  26. Replace that with:
  27.  
  28.        character*(*) prog
  29.  
  30. Then, every time ask_data_type gets called, prog will have the same
  31. length as the variable passed to it.
  32.  
  33. -- 
  34. #include <Standard_Disclaimer.h>
  35. Michael F. Stemper
  36. Power Systems Consultant
  37. mstemper@ems.cdc.com
  38.