I came across these two methods to concatenate strings:
Common part:
char* first= \"First\"; char* second = \"Second\"; char* both = malloc(strlen(fi
size_t lf = strlen(first); size_t ls = strlen(second); char *both = (char*) malloc((lf + ls + 2) * sizeof(char)); strcpy(both, first); both[lf] = ' '; strcpy(&both[lf+1], second);