Re: Find the size of variables in Fortran
- From: beliavsky@xxxxxxx
- Date: 30 Apr 2005 05:04:09 -0700
Tom Micevski wrote:
> new_to_fortran wrote:
> > Hello All,
> >
> > Is there any library function call similar to C sizeof or strlen to
> > find the size of the values assigned to variables in Fortran 77.
> >
> > For example,
> >
> > CHARACTER*20 greetings
> >
> > greetings = 'Hello World'
> >
> > How do I find the size of the value assigned to character string
> > variable greetings? By declaration, it allocates 20 bytes, but the
> > size(length) of the value assigned to greetings is less than 20
bytes.
> > I'm needing to pass on the size of the variable and the variable
itself
> > as arguments to a C function that I'd like to use from Fortran
program.
>
> len(greetings) = 20
> len_trim(greetings) = 11
>
> but these might be f90 features?
LEN and INDEX were in Fortran 77, but LEN_TRIM was introduced in
Fortran 90 . A list of Fortran 77 intrinsic functions is at Table 5 at
http://www.fortran.com/F77_std/rjcnf-15.html#sh-15 . G77 has LEN_TRIM
as an extension, and some other F77 compilers have similarly-named
extensions. A recent thread here "Little question about FORTRAN
programming" discussed these issues.
.
- References:
- Find the size of variables in Fortran
- From: new_to_fortran
- Re: Find the size of variables in Fortran
- From: Tom Micevski
- Find the size of variables in Fortran
- Prev by Date: Re: uniqueness of {if,do,case}-construct-name
- Next by Date: Re: Find the size of variables in Fortran
- Previous by thread: Re: Find the size of variables in Fortran
- Next by thread: Re: Find the size of variables in Fortran
- Index(es):
Relevant Pages
|