home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!timbuk.cray.com!shamash!ems!ems.cdc.com!mstemper
- From: mstemper@ems.cdc.com (Michael Stemper)
- Newsgroups: comp.lang.fortran
- Subject: Re: passing a string constant to a subroutine
- Message-ID: <30529@nntp_server.ems.cdc.com>
- Date: 20 Nov 92 15:14:27 GMT
- References: <EJH.92Nov19160031@khonshu.colorado.edu>
- Sender: sys@ems.ems.cdc.com
- Reply-To: mstemper@ems.cdc.com
- Organization: Empros Systems International, a division of Ceridian
- Lines: 24
- Nntp-Posting-Host: kirk.ems.cdc.com
-
- In article <EJH.92Nov19160031@khonshu.colorado.edu>, ejh@khonshu.colorado.edu (Edward J. Hartnett) writes:
- >When I want to pass a string constant to a subroutine, what size do I
- >declare the character variable to be in the subprogram. For example
- >I have a subroutine:
- >
- > subroutine ask_data_type(prog, typenum)
- >
- >This is intended to be called from one of several programs, and the
- >program name is to be passed in as the first parameter. Inside the
- >subroutine I have:
- > character*20 prog
-
- Replace that with:
-
- character*(*) prog
-
- Then, every time ask_data_type gets called, prog will have the same
- length as the variable passed to it.
-
- --
- #include <Standard_Disclaimer.h>
- Michael F. Stemper
- Power Systems Consultant
- mstemper@ems.cdc.com
-