What happens when I use different succesive calloc functions over the same pointer?
int *ptr;
ptr = (int *) calloc(X, sizeof(int));
ptr = (int *) calloc(Y, sizeof(int));
ptr = (int *) calloc(Z, sizeof(int));
Where X,Y,Z are three distinct values.
You will lose the connection to the previously allocated memory and you will no longer be able to free it - a memory leak
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With