Function program to join two words (concatenate)
#include<stdio.h>
main()
{
char a[80],b[80],c[160];
printf("\nEnter a string :");
gets(a);
printf("\nEnter the another string:");
gets(b);
stringcat(&a,&b,&c);
printf("\nThe concatenated string is :");
output(&c);
getch();
}
stringcat(s1,s2,d)
char *s1,*s2,*d;
{
while(*s1!='\0')
{
*d=*s1;
d++;
s1++;
}
*d++=' ';
while(*s2!='\0')
{
*d=*s2;
d++;
s2++;
}
*d='\0';
}
output(s)
char*s;
{
while(*s!='\0')
{
printf("%c",*s);
s++;
}
}
Comments
Post a Comment