C program that appends the one string to another string
/* C program that appends the one string to another
string. */
#include"stdio.h"
#include"string.h"
void
main()
{
char
str1[100], str2[20];
int
i, j, k, slen;
printf("Enter
first string: \n");
scanf("%s",
str1);
printf("Enter
another string: \n");
scanf("%s",
str2);
slen
= strlen(str1);
for(i=0,
j=slen; str2[i] != '\0', str1[j] != str2[i]; i++, j++)
{
str1[j]
= str2[i];
}
printf("%s",
str1);
printf("\n");
}
Output:
Comments
Post a Comment