Format of Fixed-Length Arrays of Fundamental Data Types

Type The following statements declare an array of integers and an array of floating-point numbers.
int int_array[n];
float float_array[n];
Size To calculate size, use the formula n * (s + p), where
  • n is the number of elements in the array
  • s is the size of each element
  • p is the alignment padding (check the settings of your /Sp compiler option to calculate the padding)
Alignment The alignment is the same as that of the simple data type of the array elements. For example, an array of short elements is 2-byte aligned, and an array of int elements is 4-byte aligned.
Arrays are always aligned according to the simple data type of the array.
Storage Mapping The first element of the array is placed in the first storage position. For multidimensional arrays, row-major ordering is used.


Data Mapping


/Sp Compiler Option