Pergunta de entrevista da empresa Intel Corporation

from std library c++11. 1) implement the function - void* aligned_alloc(size_t alignment , size_t size) 2) implement the function - aligned_free(void* ptr) * you can use malloc() and free() from std library in your solution

Resposta da entrevista

Sigiloso

30 de mar. de 2022

part 1 sol: void* alignment_alloc(size_t align, size_t size) { void* p1 = (void*)malloc(size + (align - 1)); int res = (int)p1 % align; void* p2 = (void*)(align - res + (int)p1); return p2; } part 2 sol was explained without writing the code.