Qualcomm Interview Question

How to implement memory allocation in C.