4 ms·
> If someone were to write such an article about C, then it would have just one line: if you malloc, then you must free. That implies you cannot return malloc'
by tzs 16y ago
> If someone were to write such an article about C, then it would have just one line: if you malloc, then you must free.
That implies you cannot return malloc'ed memory to a caller in C. I doubt many people are willing to live under that restriction.
- Xuzz 16y agoMany C APIs do exactly that: they require you (the caller) to malloc your own memory, then pass in a pointer.