If I have a design like:
struct BaseData {
int x, y, z;
} packed;
struct DataTypeA : BaseData {
struct {
int a, b, c;
} packed;
other types;
more other types;
};
DataTypeA varA;
I'm using this to write stuff to files and what not. Each data type has common header information (BaseData) and then it's own information that needs to be written to file (ie. DataTypeA needs int a, b, c).
In the above code, is the first sizeof(int) * 6 bytes of varA, which is of type DataTypeA, guaranteed to have the values of variables x, y, z and a, b, c (in that order)?
Thanks!