C Program Of Strcat() Function

C Program Of Strcat() Function

#include<stdio.h>
#include<string.h>

main()
{

char str1[100];
char str2[100];

printf("Enter string 1:\n");    //user give message and
scanf("%s",str1);     //input taken from user/keyboard

printf("Enter string 2:\n");     //user give message and
scanf("%s",str2);    //input taken from user/keyboard

printf("string 1 is '%s' and string 2 is '%s'\n",str1,str2);

strcat(str1,str2);    //concate string 2 in string 1. only string 1 is appended string 2 is same as previous.
strcat(str2,str1);    //now string 1 is added at the end of string 2

printf("Aftre concatation string 1 is '%s' and string 2 is '%s'\n",str1,str2);    //print string 1 and two after concate.

}

Related Posts