#include<stdio.h>
void strCat(char * str1, char *str2);
int main()
{
char str1[20];
char str2[20];
printf("Enter first string:\n");
gets(str1);
printf("Enter second string to concatenate to first:\n");
gets(str2);
strCat(str1,str2);
printf("Conacatenated String is:%s\n",str1);
return 0;
}
void strCat(char *p11, char *p22)
{
char *p1, *p2;
p1=p11;
p2=p22;
while(*p1)
p1++;
while(*p2)
{
*p1=*p2;
p2++;
p1++;
}
*p1='\0';
}
/*
Enter first string:
Hello India
Enter second string to concatenate to first:
How are you
Conacatenated String is:Hello IndiaHow are you
*/
No comments:
Post a Comment