xxxxxxxxxx
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
char strOrig[100], strCopy[100], i=0;
cout<<"Enter the string: ";
gets(strOrig);
while(strOrig[i]!='\0')
{
strCopy[i] = strOrig[i];
i++;
}
strCopy[i] = '\0';
cout<<"\nEntered String: "<<strOrig;
cout<<"\nCopied String: "<<strCopy;
cout<<endl;
return 0;
}
xxxxxxxxxx
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
char strOrig[100], strCopy[100];
char *origPtr, *copPtr;
cout<<"Enter the string: ";
gets(strOrig);
origPtr = &strOrig[0];
copPtr = &strCopy[0];
while(*origPtr)
{
*copPtr = *origPtr;
origPtr++;
copPtr++;
}
*copPtr = '\0';
cout<<"\nEntered String: "<<strOrig;
cout<<"\nCopied String: "<<strCopy;
cout<<endl;
return 0;
}