Some background: I'm writing a C function that reads text from a file into a dynamically reallocated array. I start off with BUF_SIZE
character, read until I've hit the limit, then reallocate. When I'm finished, I append \0
at the end of the text (not the end of the array).
Is it considered better to leave the array too big (and lose a little bit of memory -- very little) or realloc()
to the smaller size?