KodeGod.com

089. Write a program to concatinate two strings in C language

#include<stdio.h>
#include<conio.h>  
main()
{
	int i,len=0,j;
	char *s1,*s2;
	clrscr();
	printf("Enter the string 1....");
	scanf("%s",s1);
	printf("Enter the string 2....");
	scanf("%s",s2);

	for(i=0;s1[i]!='\0';i++)
	{
         len++;
	}
	j=0;
	for(i=len;s2[j]!='\0';i++)
	{
		s1[i]=s2[j];
		j++;
	}
	s1[i]='\0';

	printf("Resultant string is...%s",s1);
	getch();
}