2 ms·
Yes, C strings are \0 terminated and that is what you'd end up with. Memory management is between you, malloc() and free(). Assuming this were malloc()d memor
by js2 16y ago
Yes, C strings are \0 terminated and that is what you'd end up with.
Memory management is between you, malloc() and free().
Assuming this were malloc()d memory, if you wanted to free up the unused bytes, you'd probably:
char *condensed = strdup(z_terminated);
if (condensed)
free(z_terminated);
else
// out of memory