Re: Find the size of variables in Fortran



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?
.



Relevant Pages

  • Re: Find the size of variables in Fortran
    ... >> 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. ... as an extension, and some other F77 compilers have similarly-named ...
    (comp.lang.fortran)
  • Find the size of variables in Fortran
    ... Is there any library function call similar to C sizeof or strlen to ... as arguments to a C function that I'd like to use from Fortran program. ... Prev by Date: ...
    (comp.lang.fortran)
  • Re: reporting default integer size
    ... I don't know of anything in the standard that I can even come ... C defines the result of the sizeof operator to be in units ... subtracting two (unsigned char*) pointers to the same object. ... There are a few places Fortran makes requirements on sizes. ...
    (comp.lang.fortran)
  • Re: Sizeof vs. Strlen
    ... > library function strlen's existence? ... > instruction. ... Does 'sizeof' ...
    (comp.lang.c)
  • Re: Poll: SizeOf(variable) vs SizeOf(type), should SizeOf(variable)be banned ?
    ... Skybuck Flying wrote: ... You are an idiot. ... I know how to use SizeOf, so I don't have a problem ... "If FORTRAN has been called an infantile disorder, ...
    (alt.comp.lang.borland-delphi)