Memory alignment

Organisation of structures is important for its size.

See version :

Pas de dépendances

Download :

#include <stdio.h>

//#pragma pack(push, 1)

struct test
{
    char a;
    char c;
    int b;
};

struct test2
{
    char a;
    int b;
    char c;
};

int main()
{
    printf("sizeof test = %d\n",sizeof(struct test));
    printf("sizeof test2 = %d\n",sizeof(struct test2));
    return 0;
}




Explanations

	No explanations yet.