3 ms·
Isn't your example code a stack allocated array? Flexible array members would rather be: struct Foo { int len; int data[]; } *foo = malloc(sizeof(s
by hawski 5y ago
Isn't your example code a stack allocated array? Flexible array members would rather be:
struct Foo {
int len;
int data[];
} *foo = malloc(sizeof(struct Foo) + n*sizeof(foo->data[0]));
foo->len=n;