Format of Arrays of Structures

The C++ compiler may generate extra fields for classes that contain base classes or virtual functions. Objects of these types may not conform to the mapping shown below.

Type Here is a definition for an array of struct:
struct y mystruct_array[n];

Here is a definition of an array of packed struct:

#pragma pack(1)
struct y mystruct_array[n]; 
Alignment Each structure is aligned according to the structure alignment rules. As a result, padding may be added between consecutive structures. No padding is added in packed structures.
Storage Mapping The first element of the array is placed in the first storage position. Row-major ordering is used for multidimensional arrays.



Data Mapping