#include<stdio.h>
int string_concatenate(int i,char a[],char b[])
{
int j=0;
while( b[j]!='\0')
{
a[i] = b[j];
i++;
j++;
}
a[i]='\0';
return a;
}
int string_length(char string[] )
{
int p=0;
while(string[p]!='\0')
{
p++;
}
return p;
}
void main()
{
char s1[100], s2[100];
int l;
printf("\n Please Enter the First String : ");
gets(s1);
printf("\n Please Enter the Second String : ");
gets(s2);
l=string_length(s1);
printf("\nThe concatenated string is: ");
string_concatenate(l,s1,s2);
puts(s1);
}
Note: Need to be arranged in compiler after copied
OutPut:
Please Enter the First String : Hii
Please Enter the Second String : Hello
The concatenated string is: HiiHello