Program to copy string using pointer in C++
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char x[10],y[10];
char *p;
clrscr();
cout<<"Enter string to be copied :";
cin>>x;
p=&x[0];
int i,l;
l=strlen(x);
for(i=0;i<l;i++)
{
y[i]=*p;
p++;
}
y[i]='\0';
cout<<"\nAfter copying :"<<y;
getch();
}
OUTPUT
Enter string to be copied :abcd
After copying :abcd