3 ms·
If you’re going to allocate the memory you might as well just use the library functions that allocate exactly the space you need and copy the string into it. Th
by tinus_hn 8y ago
If you’re going to allocate the memory you might as well just use the library functions that allocate exactly the space you need and copy the string into it. These tricks are for when you use the stack as an ‘optimization’.