I am reading about the realloc
function, i.e.
void *realloc(void *ptr, size_t size);
and the author of the textbook I'm reading (K.N. King "C Programming a Modern Approach", 2nd edition, p.421, last paragraph), at some point writes
Although
realloc
doesn't require thatptr
point to memory that's being used as an array, in practice it usually does.
My apologies if this is trivial, but I'm confused. My obvious question is: how? Unfortunately, the author doesn't go any further on this.
Can you provide an expanded explanation, perhaps using a simple example?