I have an assignment in which I have to create a function to allocate a block with a starting index multiple of an int called "alignment" and a given size.
function prototype is
int block_alloc(void ** ptr_addr, size_t alignment, size_t size)
assuming that I call block alloc in that way:
int a=0;
ptr = &a;
void* ptr_2 = ptr;
ret = block_alloc ( &ptr_2 ,2* sizeof ( void*) , 2* sizeof ( int ) ) ;
I'm doing in block alloc
ptr_addr = malloc ( sizeof (int) );
but when printing the pointer it return the &a location
I need to malloc in a given offset and make all work, any hint on what I'm doing wrong?