Just a simple question.
Is it guaranteed that the pointer to a structure always points to the structure's first member?
e.g.
Is it always true that &my_struct == &(my_struct.a) ?Code:struct { data_type a; data_type b; ... } my_struct;
Just a simple question.
Is it guaranteed that the pointer to a structure always points to the structure's first member?
e.g.
Is it always true that &my_struct == &(my_struct.a) ?Code:struct { data_type a; data_type b; ... } my_struct;
Yes it does.
The value may be correct, but the type will always be wrong.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.