2 ms·
Safe? If you never use any C functions that expect strings to end in a null character, maybe. (In your approach, the strings end in newlines, including, criti
by AnimalMuppet 6y ago
Safe? If you never use any C functions that expect strings to end in a null character, maybe. (In your approach, the strings end in newlines, including, critically, the last string in the buffer, so the buffer is not null-terminated either.) So, your sort needs to not use strcmp, and your output needs to not use printf (or even puts).
I would argue that this is setting up for catastrophic failure. If not when writing, sometime later when maintenance happens.