Answer the question
In order to leave comments, you need to log in
Why is word alignment necessary?
Why does it add efficiency to the program code? What prevents addressing at odd addresses and why the structure
struct block{
char a;
char b;
char* c;
};
struct decoratedblock{
char a;
char zero[1];
char b;
char zero[1];
char* c;
};
Answer the question
In order to leave comments, you need to log in
Most modern processors read data from memory not in separate bytes, but in blocks of 2-4-8 bytes. Accordingly, if your data is not aligned in memory and the beginning falls into one block and the end into another, then you will need to get two such blocks to read.
Because the size of the pointer is 4 bytes, so the rest of the elements are aligned on 4
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question