#include<stdio.h>
#include<string.h>
main()
{
int i,j;
char str1[100],str2[100];
printf("Enter first string ");
gets(str1);/// str1 = "We"
printf("Enter 2nd string ");
gets(str2);/// str1 = "are"
strcat(str1,str2);/// weare
for(i=strlen(str1),j=0;str2[i]!=NULL;i++,j++)///str2 = "are" str1[]="are"
{
str1[i]= str2[j];
}
str1[i] = NULL;
puts(str1); ///weare
}
No comments:
Post a Comment