Son, you're in a world of hurt. You really need to get some decent documentation. The declaration of strcat is as follows:
char * strcat ( char * destination, const char * source );
You are also writing C code in your C++. Why the hell would you do that? Although the C string functions will work, they have been deprecated. Your compiler is free to quit supporting them at any time.
C++ has a string class. It does all that you need. It even overloads the '+' operator and uses it for concatenation. Further, it grows as needed, so you don't have to worry about overflow.
If you are just messing around in an attempt to learn, that's fine. Write your own string class. Overload the "=", "==", "+", and "" operators. You'll learn a lot.
Here is some functioning code that illustrates both approaches.
// The following is actually C code.
// Why write C code in C++ ????
char first  = "Hello"; // In most modern systems, these will be write protected
char second  = "Bubba"; // In other words, you can't use them as a destination
char destination ; // This must be large enough to hold the result
strcpy (destination, first);
strcat (destination, ", ");
strcat (destination, second);
// This is C++ code
cout << first << "\n" << second << "\n" << destination << endl;
string newDestination = first;
newDestination += ", ";
newDestination += second;
cout << "\n" << newDestination << endl;
Here is the output:
Originally Posted by Output