Perhaps one of the most common APIs used by application developers is the renowned malloc(3).
We use malloc(3) to dynamically allocate a chunk of memory at runtime. This is as opposed to static—or compile-time – memory-allocation where we make a statement, such as:
char buf[256];
In the preceding case, the memory has been statically allocated (at compile-time).
So, how exactly do you use malloc(3)? Let's check out its signature:
#include <stdlib.h> ...