Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!agate!ucbvax!CIMS18.NYU.EDU!mckenney From: mckenney@CIMS18.NYU.EDU (Alan M. McKenney) Newsgroups: comp.lang.fortran Subject: Re: LEN and CHARACTER arrays. Message-ID: <9101311648.AA04788@cims18.nyu.edu> Date: 31 Jan 91 16:48:05 GMT References: <9101281822.AA03827@cims18.nyu.edu> Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: mckenney@cs.nyu.edu Lines: 34 In <9101281822.AA03827@cims18.nyu.edu>, I wrote: > Given a character (dummy argument) array declared > > CHARACTER*(*) CARRAY(*) > > what is the ANSI-standard-conformant way of getting the length > of each element? > > > From reading the standard, I had gotten the impression that > LEN(CARRAY) was correct, and it works on my Sun workstation, but it > doesn't work on our CONVEX. Instead, I had to write LEN(CARRAY(1)). .... I got quite a bit of E-mail, all of it saying, with varying levels of Authority, that LEN(CARRAY(1)) was correct ANSI FORTRAN-77, and LEN(CARRAY) was not. Many thanks to all those who took the trouble to enlighten me! Some people also found the standard a little unclear, as I did. (Others found it quite clear.) One or two said that LEN can also take a character expression as an argument (e.g., LEN( 'abc' // CARRAY(2) // 'def' ), I suppose.) A few people said that LEN(CARRAY) would be legal in FORTRAN-90, though I was unsure whether it would be equivalent to LEN(CARRAY(1)) or would instead give the number of elements in the array. (But that's another question.) Anyway, thanks again for the advice. Alan McKenney E-mail: mckenney@cs.nyu.edu (INTERNET) Courant Institute,NYU ...!cmcl2!cs.nyu.edu!mckenney (UUCP)