Concatenation of two strings.
Program to concatenate two strings.
#include<stdio.h>
int main()
{
char str1[50], str2[50], str3[100];
int i=0,j=0;
printf("Enter a string : ");
gets(str1);
printf("Enter another string : ");
gets(str2);
while(str1[i]!='\0'){
str3[i]=str1[i];
i++;
}
while(str2[j]!='\0') {
str3[i]=str2[j];
i++;
j++;
}
str3[i]='\0';
printf("After concatenation the array is : %s",str3);
return 0;
}
No comments:
Post a Comment