Quantcast
Viewing all articles
Browse latest Browse all 98

A Quick Tutorial on Implementing and Debugging Malloc, Free, Calloc, and Realloc

“This tutorial is going to assume that you know what pointers are, and that you know enough C to know that *ptr dereferences a pointer, ptr->foo means (*ptr).foo, that malloc is used to dynamically allocate space, and that you’re familiar with the concept of a linked list. If you decide to work through this tutorial without really knowing C, please let me know what parts could use more exposition. If you want to look at all of this code at once, it’s available here. The tests are from Andrew Roth, who had a github repo lying around with some tests for malloc…”

http://danluu.com/malloc-tutorial/


Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 98

Trending Articles