Code In Tech - The Ultimate World of Computer Technology

Sunday, 22 April 2012

C program for combination of two string

SOURCE CODE:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
 int i=0,j=0;
 char a[25],b[25];
 clrscr();
 printf("Enter first string\n");
 gets(a);

 printf("Enter second string\n");
 gets(b);
// strcat(a,b);
 while(a[i]!='\0')
 {
  a[j]=a[i];
   i++;
   j++;
  }
 i=0;
 while(b[i]!='\0')
 {
  a[j]=b[i];
  i++;
  j++;
 }
 a[j]='\0';
 printf("\nCombination of two string is\n");
 puts(a);
 getch();
}

No comments :

Post a Comment