C++ Program To Copy One String To Another

#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
  char s1[10], s2[10];
  clrscr();
  cout<<"Enter string s1: ";
  cin>>s1;
  strcpy(s2, s1);
  cout<<"String s2: "<<s2;
getch();
}

OUTPUT:

Enter string s1: learn
String s2: learn

Sharing Is Caring

Leave a Comment