#include <iostream>
using std::cout;
using std::endl;
#include <cstring>
using std::strcat;
using std::strncat;
int main()
{
char s1[ 20 ] = "123456";
char s2[] = "abcdefghi";
char s3[ 40 ] = "";
strcat( s1, s2 );
cout << s1 << "\ns2 = " << s2;
strncat( s3, s1, 6 ); // places '\0' after last character
cout << s1 << "\ns3 = " << s3;
strcat( s3, s1 );
cout << s1 << "\ns3 = " << s3 << endl;
return 0;
}
123456abcdefghi
s2 = abcdefghi123456abcdefghi
s3 = 123456123456abcdefghi
s3 = 123456123456abcdefghi