C_SIZEOF— Size in bytes of an expression
C_SIZEOF(X)calculates the number of bytes of storage the expression
N = C_SIZEOF(X)
|X||The argument shall be an interoperable data entity.
ISO_C_BINDINGmodule). Its value is the number of bytes occupied by the argument. If the argument has the
POINTERattribute, the number of bytes of the storage area pointed to is returned. If the argument is of a derived type with
ALLOCATABLEcomponents, the return value does not account for the sizes of the data pointed to by these components.
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
REAL variables are unusually padded.