I think I\'ve got a good grasp on how to handle memory in C++ but doing it in C is different I\'m a bit off.
In C++ I\'ve got constructors and destructors, I\'ve got the
The sad truth is that C isn't really designed to encapsulate all those memory management issues.
If you look at fairly high quality APIs like POSIX, you'll see that the common pattern is that you pass a pointer to a pointer to a function, which then allocates the memory, and that you later pass it again to a function that destroys it.
It's not necessarily elegant, but I don't think there are many ways to make it really elegant without simulating OOP in C.