5.32 Compiler storage of data objects by natural byte alignment

C data types are aligned on specific byte boundaries, depending on their type.

By default, the compiler stores data objects by byte alignment as shown in the following table.

Table 5-9 Compiler storage of data objects by byte alignment

Type Bytes Alignment
char, bool, _Bool 1 Located at any byte address.
short, wchar_t 2 Located at any address that is evenly divisible by 2.

float, int, long, pointer

4 Located at an address that is evenly divisible by 4.

long long, double, long double

8 Located at an address that is evenly divisible by 8.
Related concepts
5.30 Types of data alignment
5.31 Advantages of natural data alignment
5.34 Unaligned data access in C and C++ code
5.35 The __packed qualifier and unaligned data access in C and C++ code
Related reference
5.33 Relevance of natural data alignment at compile time
Non-ConfidentialPDF file icon PDF versionARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.