2 ms·
I know there are already plenty of comments about the problems but might as well give mine too... In one sentence: this guy managed to reinvent a variant of st
by userbinator 8y ago
I know there are already plenty of comments about the problems but might as well give mine too...
In one sentence: this guy managed to reinvent a variant of strcat and get it completely wrong.
Here's a somewhat better version:
char *combine(char *s, char *t) {
size_t m = strlen(s), n = strlen(t);
char *ret = malloc(m + n + 1);
if(ret) {
memcpy(ret, s, m);
strcpy(ret + m, t);
}
return ret;
}