Created
March 14, 2013 02:18
-
-
Save anonymous/5158287 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Move concat() function out of main()
You can't declare a function within a function.