C_SIZEOF — Size in bytes of an expression#
-
C_SIZEOF(X)#
C_SIZEOF(X)
calculates the number of bytes of storage the expressionX
occupies.- Parameters
X – The argument shall be an interoperable data entity.
- Returns
The return value is of type integer and of the system-dependent kind
C_SIZE_T
(from theISO_C_BINDING
module). Its value is the number of bytes occupied by the argument. If the argument has thePOINTER
attribute, the number of bytes of the storage area pointed to is returned. If the argument is of a derived type withPOINTER
orALLOCATABLE
components, the return value does not account for the sizes of the data pointed to by these components.
- Standard:
Fortran 2008
- Class:
Inquiry function of the module
ISO_C_BINDING
- Syntax:
N = C_SIZEOF(X)
- 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
T
unless you are using a platform where defaultREAL
variables are unusually padded.- See also:
SIZEOF — Size in bytes of an expression, STORAGE_SIZE — Storage size in bits