Simple function for append two strings. char* str_append(const char* a, const char* b){ size_t len = strlen(a) + strlen(b); char *ret = (char*)malloc(len * sizeof(char) + 1); *ret = ‘\0’; return strcat(strcat(ret, a) ,b); }