2 ms·
This is pretty similar to: MyStructA { ... MyStructB b[]; }; MyStructA* a = malloc(sizeof(MyStructA) + sizeof(MyStructB)); b = &a->b[0]; (Exc
by loeg 4y ago
This is pretty similar to:
MyStructA {
...
MyStructB b[];
};
MyStructA* a = malloc(sizeof(MyStructA) + sizeof(MyStructB));
b = &a->b[0];
(Except, of course, that the syntax for locating 'b' is nicer this way, because you don't have to explicitly address the memory after 'a' and cast it to 'MyStructB'.)