Skip to content

Instantly share code, notes, and snippets.

@szolotykh
Created April 19, 2013 04:17
Show Gist options
  • Save szolotykh/5418115 to your computer and use it in GitHub Desktop.
Save szolotykh/5418115 to your computer and use it in GitHub Desktop.
Merge two strings. Note: Don't forget to free memory after using function.
char* strmerge(char* str1, char* str2){
char* str = (char*)malloc(strlen(str1) + strlen(str2) + 1);
strcpy(str, str1);
strcat(str, str2);
return str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment