/* COMBINE THE TWO STRINGS WITHOUT USING LIBRARY FUNCTION */
#include<stdio.h>
#include<conio.h>
main()
{
char str1[20],str2[20];
int i,j;
clrscr();
printf("\n Enter a string1 : ");
gets(str1);
printf("\n\n Enter a string2 : ");
gets(str2);
for(i=0; str1[i]!='\0'; i++);
for(j=0; str2[j]!='\0'; j++)
{
str1[i+j]=str2[j];
}
str1[i+j]='\0';
printf("\n\n After combined the string is = ");
puts(str1);
getch();
}
No comments:
Post a Comment