Simple concatenate two strings

Simple concatenation of two strings to third one using standard libs. Just put two strings and as function result you got concatenated one.
1
2
3
4
5
6
7
char*
concat(char* first, char* second) {
    char* result = malloc(snprintf(NULL, 0, "%s%s", first, second)+1);
    sprintf(result, "%s%s", first, second);
    return result;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX