Padding for Struct Members
Learn more about how structures are represented in memory.
We'll cover the following...
We'll cover the following...
Introduction
Let’s revisit a previous example for a structure definition.
typedef struct
{
char x;
int y;
} TExample;
Assume the following declaration:
TExample p;
When representing it in memory, we may assume the following layout:
xstarts at the beginning ofp.xis 1 byte long.ystarts 1 byte afterx.