Skip to content

Instantly share code, notes, and snippets.

Created March 14, 2013 02:18
Show Gist options
  • Save anonymous/5158287 to your computer and use it in GitHub Desktop.
Save anonymous/5158287 to your computer and use it in GitHub Desktop.
#include <stdio.h>
/*int main(int argc, const char * argv[])*/
int main() {
char str1[256] = "Try to learn";
char str2[256] = "C and C++ maybe";
char output[1000];
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 != '\0')
{
output[k] = str2[j];
k++;
j++;
}
}
concat(str1, str2, output);
printf("%s", output);
}
@liovch
Copy link

liovch commented Mar 14, 2013

Move concat() function out of main()
You can't declare a function within a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment