Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!mit-eddie!uw-beaver!ubc-cs!alberta!mts.ucs.UAlberta.CA!Al_Dunbar From: userAKDU@mts.ucs.UAlberta.CA (Al Dunbar) Newsgroups: comp.lang.fortran Subject: Re: integer variable format address Message-ID: Date: 6 Mar 91 02:40:07 GMT References: <6769@idunno.Princeton.EDU> Organization: MTS Univ of Alberta Lines: 30 In article <6769@idunno.Princeton.EDU>, hsbrown@lemmy.Princeton.EDU (Scott Brown) writes: >What is wrong with the following program? > program test > integer k > k=1 > write(*,k) > > 1 format('here is line 1') > end > > > >I have two FORTRAN books that suggest the write(*,k) >statement should work. I have two FORTRAN compilers >that give a bus error. Any ideas would be appreciated. Sell your two books, or read them more carefully; this is not standard Fortran. When a variable appears as a format specifier, it supplies an address at which should be found a format specification in the form of a string literal. The only way I know to get an integer variable to store a statement number is with the ASSIGNED GOTO; even then the docs/standard warn severely against referencing in any other way a variable used for this purpose. -------------------+------------------------------------------- Al Dunbar | Edmonton, Alberta | Disclaimer: "I disclaim disclaimers" CANADA | -------------------+-------------------------------------------