Programming Question

Question: Write an aligned malloc and free function that supports allocating memory such that the memory address returned is divisible by a specific power of two. Example align_malloc(1000, 128) will return a memory address that is a multiple of 128 and that points to memory of size 1000 bytes. aligned_free() will free memory allocated by align_malloc.

From: Cracking the Coding Interview [McDowell]

Subject: C and Cpp

Load Another Question


Select a Subject