Skip to content

Instantly share code, notes, and snippets.

@liovch
Forked from anonymous/gist:5158287
Last active December 14, 2015 22:28
Show Gist options
  • Save liovch/5158302 to your computer and use it in GitHub Desktop.
Save liovch/5158302 to your computer and use it in GitHub Desktop.
#include <stdio.h>
/*int main(int argc, const char * argv[])*/
void concat(char* str1, char* str2, char* output);
{
int i, j, k;
i = j = k = 0;
while (str1[i] != '\0')
{
output[k] = str1[i];
i++;
k++;
}
while (str2[j] != '\0')
{
output[k] = str2[j];
k++;
j++;
}
output[k] = 0;
}
int main() {
char str1[256] = "Try to learn";
char str2[256] = "C and C++ maybe";
char output[1000];
concat(str1, str2, output);
printf("%s", output);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment