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