I am writing my own code for malloc, calloc, and realloc.
When using call I call:
int *ptr = calloc(100, 4);
But when I try to print the addresses using:
for(i=0; i < 100; i++)
fprintf(stderr,"0x%x\n", ptr[i]);
Gives me all:
0x0
But using:
for(i=0; i < 100; i++)
fprintf(stderr,"0x%x\n", (ptr+i));
I get all sequential addresses.
Thoughts or ideas? I'm sure my malloc code works.