I am a bit confused about Memory address alingment for union.
typedef union {
char state[x];
char encode[4];
int index;
} Location;
We use several alignment rule while writing code, ex:
int 4 bit alignment
double 4 bit for linux
char * 4 bit for linux
“how that union will be aligned”
For those conditions;
If
x < 4 ?
x = 4 ?
x > 4 ?
platform linux
assembly x86 64 bit
NOTE: If you have better opinion, feel free when improve that question
I’m a bit confused as to what your actual question is 🙂
But, if you’re asking how that union will be aligned, a union has to follow two relevant rules here.
In other words, it’s likely that the
intis the driving force here in terms of alignmentThe value of
xis irrelevant here if the alignment of a singlecharis one. It’s not the whole array that needs to be aligned, just each element of it.