How to Determine the Size of a User-Defined Data TypeLast reviewed: April 12, 1996Article ID: Q149753 |
The information in this article applies to:
SUMMARYThe Fortran Run-Time Library included with Microsoft Fortran PowerStation version 4.0 does not include an intrinsic function or subroutine that can return the number of bytes in use by a single user-defined data type variable. You can, however, use the LOC() intrinsic function to obtain the starting addresses of two user-defined data type variables, contiguous in memory, and subtract their addresses resulting in the number of bytes used by one variable of this type.
MORE INFORMATIONDo the following to calculate the number of bytes in use by a single user- defined data type variable:
Sample Code to Illustrate TechniqueC Compile options needed: none
type udt integer a real b end type type (udt) myt(2) print *, 'Number of bytes used: ', loc(myt(2)) - loc(myt(1)) end Program OutputNumber of bytes used: 8
|
Additional reference words: 4.00 kbinf
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |