Strcat() function is used to concatenate two string
strcat( ) :This function is used to concatenate two string. By concatenation , we means that the second string is added at the end of the first string.
The general form is : void strcat(string1,string2);
Consider the following program :
#include<stdio.h>
#include<string.h>
#include<conio.h>
void main( )
{
char str1[50],str2[50];
int i;
clrscr( );
printf("\nEnter the first string :");
scanf("%s",str1);
printf("\nEnter the second string :");
scanf("%s",str2);
strcat(str1,str2);
printf("\nResult : %s",str1);
getch( );
}
output :
Enter the first string : Jatin
Enter the second string :Lalit
Result: JatinLalit
Comments
Post a Comment