Hi,
Can anyone guide me on the following question. What is the best practices concerning designing C library API which works with structures, in terms of memory management and initialization.
I.e. for structure "foo", which one (and why) is more preffered:
1.
struct foo* foo_create(...);
void foo_destroy(struct foo* p);
2.
void foo_init(struct foo* p);
void foo_cleanup(struct foo* p);
3. Combination of 2 & 3.
Thank you.