</>EmbeddedInterview

Implement strcat().

Easy"Coding: Memory & String Functions"
char *my_strcat(char *dst, const char *src)
{
    char *d = dst;
    while (*d) d++;                       /* find the end of dst */
    while ((*d++ = *src++) != '\0') { }   /* append, including '\0' */
    return dst;
}

Points: dst must have room for both strings plus the terminator; repeated strcat in a loop is O(n²) because each call rescans dst (keep a pointer to the end instead). Bounded alternative: snprintf(dst + len, size - len, "%s", src).