Manual Reference Pages  - c_sizeof (3fortran)

NAME

C_SIZEOF(3) - [ISO_C_BINDING] Size in bytes of an expression

SYNOPSIS

result = c_sizeof(x)

CHARACTERISTICS

DESCRIPTION

C_SIZEOF(3) calculates the number of bytes of storage the expression X occupies.

OPTIONS

o X : The argument shall be an interoperable data entity.

RESULT

The return value is of type integer and of the system-dependent kind csize_t (from the iso_c_binding module). Its value is the number of bytes occupied by the argument. If the argument has the pointer attribute, the number of bytes of the storage area pointed to is returned. If the argument is of a derived type with pointer or allocatable components, the return value does not account for the sizes of the data pointed to by these components.

EXAMPLES

Sample program:

    program demo_c_sizeof
    use iso_c_binding
    implicit none
    real(c_float) :: r, s(5)
       print *, (c_sizeof(s)/c_sizeof(r) == 5)
    end program demo_c_sizeof

Results:

     >   T

The example will print .true. unless you are using a platform where default real variables are unusually padded.

STANDARD

Fortran 2008

SEE ALSO

STORAGE_SIZE(3)

Fortran intrinsic descriptions


Nemo Release 3.1 c_sizeof (3fortran) November 02, 2024
Generated by manServer 1.08 from dda3e6ef-e655-4e6e-91a3-45738df9bff6 using man macros.