3 ms·
Basically it's an O(n^2) algorithm... well-known story about that here: http://www.joelonsoftware.com/articles/fog0000000319.html http://www.joelonsoftware.com
by userbinator 12y ago
Basically it's an O(n^2) algorithm... well-known story about that here:
http://www.joelonsoftware.com/articles/fog0000000319.html http://www.joelonsoftware.com/articles/fog0000000319.html
The design of strcat() itself is partially to blame for this - the return value could've been more useful, like the number of characters in the resulting string or a pointer to the end of the appended string so it could be used to chain concatenations, but instead they chose to return the exact same pointer that was passed in as the source.