9.57 C_SIZEOF — Size in bytes of an expression
- Description:
-
C_SIZEOF(X)calculates the number of bytes of storage the expressionXoccupies. - Standard:
-
Fortran 2008
- Class:
-
Inquiry function of the module
ISO_C_BINDING - Syntax:
-
N = C_SIZEOF(X) - 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 theISO_C_BINDINGmodule). Its value is the number of bytes occupied by the argument. If the argument has thePOINTERattribute, the number of bytes of the storage area pointed to is returned. If the argument is of a derived type withPOINTERorALLOCATABLEcomponents, the return value does not account for the sizes of the data pointed to by these components. - Example:
-
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 defaultREALvariables are unusually padded. - See also:
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gfortran/C_005fSIZEOF.html