Concatenating function not working right?
I have a function that concatenate the strings in an array(2D)
Ex 1: Sean Connery Micheal King James Wood
Result: SeanConnery MichealKing JamesWood ...
The concatenation function working correctly and displays correctly in the function.
But if I make another function to display it, it shows this
Ex 2: SeanConnery Sean MichealKing Micheal JamesWood James..
It adds to first name. Why?
Code:
void Concatenation( char dest[200][13] )
{
// loop through and concatenation the strings
for(int i=0;i<200;i+=2)
{
myStrCat(dest[i],dest[i+1]); // mystrcat is equalto strcat()
cout << dest[i] << " "; // display correctly Ex 1
}
}
Code:
void display( char dest[200][13] ){
// Initialize variables
int i;
for( i = 0; i < 208; i++ )
{
cout << dest[i] << " "; // display wrongly displays Ex2
}
}