2 ms·
Does C have destructors?
by windowojji 6y ago
Does C have destructors?
- jonathankoren 6y agoOnly if you make it and call it. C has free, which deallocates a block of memory pointed to by a pointer. If it's a struct, the struct is deallocated. If the struct contains pointers, that memory is still there. If you've lose all the pointers to that chunk of memory, you now have a memory leak. It is not uncommon to make your own allocators and deallocaters for complex structs.