[UP]


Manual Reference Pages  - c_sizeof (3)

NAME

c_sizeof(3f) - [FORTRAN:INTRINSIC:ISO_C_BINDING] Size in bytes of an expression

CONTENTS

Syntax
Description
Arguments
Return Value
Example
Standard
Class
See Also

SYNTAX

n = c_sizeof(x)

DESCRIPTION

c_sizeof(x) calculates the number of bytes of storage the expression X occupies.

ARGUMENTS

X - The argument shall be an interoperable data entity.

RETURN VALUE

The return value is of type integer and of the system-dependent kind c_size_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.

EXAMPLE

Sample program:

   use iso_c_binding
   integer(c_int) :: i
   real(c_float) :: r, s(5)
   print *, (c_sizeof(s)/c_sizeof(r) == 5)
   end

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

STANDARD

[[Fortran 2008]]

CLASS

Intrinsic function

SEE ALSO

[[storage_size]]


c_sizeof (3) March 18, 2019
Generated by manServer 1.08 from c7d857f8-a732-4d15-8312-3413ce4dad4c using man macros.