I am wondering why the following two types
struct {
double re[2];
};
and
double re[2];
have the same size in C? Doesn't struct add a bit of size overhead?
No, it just merely composes all the elements into one higher-level element whose size is merely the individual elements' sizes added up (plus some padding depending on alignment rules, but that's out of the scope of this question).