Losing the magic
Losing the magic
Posted Jan 3, 2023 9:56 UTC (Tue) by geert (subscriber, #98403)In reply to: Losing the magic by tabberson
Parent article: Losing the magic
struct foo {
...
struct bar embedded;
...
};
If you have a pointer to the "embedded" member of type "struct bar", you can convert it to a pointer to the containing "struct foo" using the
container_of() macro.
