Silverfrost Forums

Welcome to our forums

Nested structures.

16 Apr 2014 7:43 #13963

Hi.

In my code I am using nested structure:

TYPE SUBSTRUCTURE INTEGER ::ii_Number REAL ::rr_Number CHARACTER(LEN=40)::TText END TYPE SUBSTRUCTURE

TYPE SD_TYPE INTEGER ::i_Number REAL ::r_Number CHARACTER(LEN=40)::Text TYPE (SUBSTRUCTURE) :: subStructure END TYPE SD_TYPE

TYPE(SD_TYPE), POINTER:: p_SD_TYPE

allocate(p_SD_TYPE, SHARENAME='CFDATA2')

Although the SUBSTRUCTURE is located at the end of structure SD_TYPE, in the allocated memory is at the beginning. Can you explain me why? And how can I achieve exact order in the memory? Thank you very much.

Jan

16 Apr 2014 8:20 #13964

In Fortran, if you want a particular order, then you need to use the SEQUENCE statement.

16 Apr 2014 8:43 #13965

Thank you.

Please login to reply.