Program to copy a string into another using a user-defined function (i.e. without using string handler function)
#include<stdio.h>
#include<conio.h>
main()
{
char s1[25],s2[25];
char copy(char[],char[]);
clrscr();
s1[25]=0,s2[25]=0;
printf("Enter string1: ");
gets(s1);
printf("\nUsing copy function...");
copy(s1,s2);
printf("\nString2: ");
puts(s2);
return 0;
}
char copy(char a[25], char b[25])
{
int i,j;
for(i=0,j=0;a[i]!='\0';i++,j++)
b[j]=a[i];
b[j]='\0';
return *b;
}