DEV Community

Discussion on: C Programming!

Collapse
 
__mateidavid profile image
Matei David

Hi,

It depends on what level you currently are in C and how much you can do.

In my C/C++ module in university, whenever we would talk about memory management and pointers (and how to use malloc() and free() ) we would always be told that we can write our own memory allocator.

It's not an easy thing to do, but there are a lot of examples already on GitHub about own implementations of malloc. As far as I know, the standard library malloc is not as efficient as others that have been published. It would give you a lot of context into how to operate at a really low-level, work with the stack/heap, manage memory, pointers, addressed etc and there are already a lot of examples, guides and tutorials online so if you ever get stuck just do a google search.

In short, try making your own memory allocator and your own free function and see where that goes! Doesn't have to be efficient or as good as malloc but it will surely put you right in the middle of C and you will get to work or at least see structs, unions, tagged unions, pointers and most of C's features.

Hope this helps!