Are there any guarantees that realloc() will always shrink a buffer in-place?? So that the following:
new_ptr = (data_type *) realloc(old_ptr, new_size * siz
No. You shall not rely on this.
According to spec 7.20.3.4/4:
The realloc function returns a pointer to the new object (which may have the same value as a pointer to the old object), or a null pointer if the new object could not be allocated.
realloc