Qualcomm interview question

How to implement memory allocation in C.