S
subramanian
I have taken the following prototype from K & R.
void *realloc(void *p, size_t size);
Suppose p was earlier allocated by malloc. Suppose I am calling realloc
with larger size value.
If realloc is successful, will the return pointer be the same as p or
will it be different.
K & R 2nd edition says "realloc returns a pointer to the new space".
Why I am asking is that if they are different, the older pointer value
of p should be freed.
Thanks
void *realloc(void *p, size_t size);
Suppose p was earlier allocated by malloc. Suppose I am calling realloc
with larger size value.
If realloc is successful, will the return pointer be the same as p or
will it be different.
K & R 2nd edition says "realloc returns a pointer to the new space".
Why I am asking is that if they are different, the older pointer value
of p should be freed.
Thanks