c - Why is a pointer value is changed once being returned? -


disclaimer: homework assignment question being asked unrelated actual assignment.

i have implement simple memory manager 1 of classes, in function my_malloc before return function value being return 1 (say: 0x7fb0049ed410) , in calling function (say: 0x49ed410).

my_malloc(unsigned int);

typedef void* addr; addr raddr = (addr) (memoryheader + sizeof(header))) printf("giving memory: %p : %p\n", addr, raddr); return raddr 

calling function();

void* mem = my_malloc(10*sizeof(char)); printf("calling function: %p\n", mem); 

i'm sorry if isn't helpful thought might enough problem across without giving 600 , line of code.

warning begin given:

incompatible integer pointer conversion assigning 'void *' 'int' 

the code calling my_malloc() function isn't being given proper declaration/prototype function, it's treating returned pointer int.

place following before call my_malloc() (ideally should in header included code calls function code defines function ensure it's correct).

void* my_malloc(size_t size); 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -