include
int main(){
void concatenarStrings(char string1[], int t1,
char string2[], int t2,
char string3[]);
char palavra1[]={'p','a','o','c','o','m'};
char palavra2[]={'m','o','r','t','a','d','e','l','a'};
char novaPalavra[16];
concatenarStrings(palavra1,6,palavra2,9,novaPalavra);
int i;
for(int i = 0;i < 1;++i){
printf("%c",novaPalavra[i]);
}
return 0;
}
void concatenarStrings(char string1[], int t1,
char string2[], int t2,
char string3[]){
int i,j;
for(i = 0; i < t1; ++i){
string3[i] = string1[i];
}
for(j = 0; j < t2; ++j){
string3[t1 + j] = string2[j];
}
}
My code above compiles correctly in DEV C ++, it does not show any errors. It is a code to concatenate the strings word1 and word2, but always when I run it, instead of forming the word pao with mortadela, it displays only the word p. I can not see where the error is.