Saturday 26 September 2015

Concatenation string without using string funtion

#include<stdio.h>
#include<conio.h>
void main()
{ int i,j;
char x[10],y[10] ;
 clrscr();
      printf("enter string:");
      gets(x);
      printf("enter string2:");
      gets(y);
      for(i=0;x[i]!='\0';i++)
      ;
      x[i]=' ';
      i++;
      for(j=0;y[j]!='\0';i++,j++)
  x[i]=y[j];
x[i]='\0';
printf("string combined is %s\n",x);
getch();
}

No comments:

Post a Comment