strcat( )
This function is used to join 2 Strings.
Syntax:
strcat(s1,s2);
Example:
string1- happy string2 – hello strcat(string1,string2)- string1-happyhello string2-hello
Example Program:
C program to concatenate two strings using string handling functions.
#include<stdio.h>
main()
{
char s[10],s1[10];
int x;
printf("enter a string ");
gets(s);
printf("enter string 2 ");
gets(s1);
printf("strings are\n ");
puts(s);
puts(s1);
strcat(s,s1);
printf("after concatenation ");
puts(s);
}
Output:

Example Program:
C program to compare two strings without using string handling functions.
#include<stdio.h>
#include<string.h>
main()
{
char a[10],b[10];
int i,n,j;
printf("enter string1 ");
gets(a);
printf("enter string2 ");
gets(b);
n=strlen(a);
for(i=n,j=0;b[j]!='\0';i++,j++)
{
a[i]=b[j];
}
a[i]='\0';
printf("after concatenation ");
puts(a);
}
Output: