void catstr(char [],char []);
void main()
{
char str1[50],str2[50];
printf("Enter 1st string (str1) :");
gets(str1);
printf("\nEnter 2nd string (str2) :");
gets(str2);
catstr(str1,str2);
printf("\n\nAfter concatenating(joining) these strings\n\nFinal string is ");
puts(str1);
getch();
}
void catstr(char txt1[], char txt2[])
{
int i,j;
for(i=0;txt1[i]!='\0';i++);
for(j=0;txt2[j]!='\0';j++,i++)
{
txt1[i]=txt2[j];
}
txt1[i]='\0';
}
0 comments:
Post a Comment