structures in C
I did not know this :
A pointer to a
structure object, suitably converted, points to its initial member (or if that member is a
bit-field, then to the unit in which it resides), and vice versa. There may be unnamed
padding within a structure object, but not at its beginning.
This means that you can embed a structure inside another structure and use the embedded structure to implement a generic data structure.
For example,
struct my_struct {
struct linked_list llcoolj;
int x;
char acter;
}
struct my_struct a;
linked_list_insert (some_list, &a);
struct linked_list * l = linked_list_head (some_list);
struct my_struct * b = (struct my_struct*)l;