I have following code
#include<stdio.h>
int main () {
void *result[20];
void *endptr;
void *x;
for (i = 0; i < 20; i++) {
result[i] = malloc(10);
printf("111 : %d\n",result[i]);
}
endptr= sbrk(0);
printf("\n222 : %d\n",endptr);
x = malloc(60); ----------- error
return 0;
}
I want to print numeric value of all the void pointers and the count how many times sbrk function called form malloc?
If I print *endptr in printf statement it gives me error. Currently I think it prints address where memory is allocated. %x would just convert current value in hex and print right?
x = malloc(60) also gives error : void value not ignored as it ought to be How can I do that?
Thanks