#include<stdio.h>//header file
#include<conio.h>//header file
#include<string.h>//header file
void main() //starting of the main() function
{
int l,l1,i,j; //declaration of the variables
char a[10],b[10];
clrscr();
printf("program that copies a string into another array without using library
function");
printf("\n\n\n\t\t------------INPUT-------------");
printf("\n\nenter the source string");//taking input from the user
scanf("%s",&a);
printf("\nenter the destination string where the source string has to be
copied");
scanf("%s",&b);
l=strlen(a);
l1=strlen(b);
if(l>=l1)
{
for(i=0;i<l;i++)
{
b[i]=a[i];
}
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nthe destination string is=%s",b);//printing output
}
else
{
for(i=0;i<l;i++)
{
b[i]=a[i];
}
for(j=l;j<l1;j++)
{
b[j]='\0';
}
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nthe destination string is=%s",b);//printing output
}
getch();
}