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

Popular posts from this blog

Customize User's Profile in ASP.NET Identity System

Lambda two tables and three tables inner join code samples