GoogelAddUnit1

Thursday, 10 March 2011

C Program to concatinate two string with out using Builtin functions.


/*  string concatnation without using build functions  */                                
#include<stdio.h>
#include<conio.h>
main()
{
  int i,j,k;
  char a[20],b[20],c[20],d[20];
  clrscr();
  printf("\n enter the three strings");
  scanf("%s%s%s",a,b,c);
  for(i=0;a[i]!='\0';i++)
  {
   d[i]=a[i];
   d[i]=' ';
  }
  for(j=0;b[j]!='\0';j++)
  {
   d[i+j+1]=b[j];
   d[i+j+1]=' ';
  }
  for(k=0;c[k]!='\0';k++)
  {
   d[i+j+k+2]=c[k];
   d[i+j+k+2]='\0';
  }
  printf("\n the combined string is....%s",d);
  getch();
}

No comments:

Post a Comment