/* Merging three strings. */
#include <stdio.h>
int main()
{
char a[20], b[20], c[20];
int i, x = 0, y = 0;
printf("Enter string A: ");
gets(a);
printf("Enter string B: ");
gets(b);
printf("Enter string C: ");
gets(c);
for(i = 0; a[i] != '\0'; i++)
x++;
for(i = 0; b[i] != '\0'; i++){
a[i+x] = b[i];
y++;
}
for(i = 0; c[i] != '\0'; i++)
a[i+x+y] = c[i];
a[i+x+y] = '\0';
printf("String A after merging is...\n");
puts(a);
return 0;
}
Comments
Post a Comment