strcat()

Prototype: char *strcat(char *Destination, char *Source);
Header File: string.h (C) or cstring (C++)
Explanation: This function will concatenate (add to the end) the string pointed to by source on to the string pointed to by Destination. Returns a pointer to the Destination string.



Example:
//Example concatenates two strings to output
//By asking the user for input
#include <cstring>
#include <iostream>

using namespace std;

int main()
{
    char *s1 = new char[30];
    char *s2 = new char[30];
    cout<<"Enter string one(without spaces): ";
    cin>>s1;
    cout<<"Enter string two(without spaces): ";
    cin>>s2;
    cout<<strcat(s1, s2);
}
Other Functions