You are on page 1of 1

#include<iostream.

h>
#include<conio.h>
void strcopy(char str1[20],char str2[20])
{
int n=0,i;
while(str1[n]!='\0')
{
n++;
}
for(i=0;i<n;i++)
{
str2[i]=str1[i];
}
str2[i]='\0';
cout<<"Copied string is: \n";
cout<<str2;
}
void main()
{
clrscr();
char str1[20],str2[20];
cout<<"Enter any string\n";
cin.getline(str1,20);
strcopy(str1,str2);
getch();
}

You might also like