C++ string concat without strcat?

Good, let’s assume i always have a couple of char arrays, same length, same which has a name with unknown length inside it.

How do i concat it I’m quite close with my formula…I only can’t think right this moment, no rest.

char sa81=0, sb81=0;
cout << "Enter your own name:";
cin >> sb;
strcpy(sa, sb);

with regard to (i=0; claime! =”; i++)
with regard to (j=0; sbj! =”; j++)
saj = sbj;

cout <<endl<< sa;

At present expected output shall be something similar to this
Type in your name:Damien
end result >> Damien
DamienDamien.

thanks

Find the final of that string, then do any strcpy correct there.For locating the end in the string, you can just utilize a for trap scanning for any null terminator, or you should use strlen as well as just add the result to your pointer.

char * conclude = sa + strlen(sa);
strcpy(end, sb);

Leave a Reply