In this program the contents of aray2 are being copied and pasted in aray.
#include <iostream>
#include <cstring>
using namespace std;
void main()
{
char aray[20];
cin.getline(aray,10,'\n'); //Prompts user to enter data
char aray2[20];
cin.getline(aray,10,'\n'); //Prompts user to enter data
char *strcpy(char * aray ,char const *aray2); //const since we don't want elements in aray2 to be changed //accidently
cout << aray <<endl;
}
#include <iostream>
#include <cstring>
using namespace std;
void main()
{
char aray[20];
cin.getline(aray,10,'\n'); //Prompts user to enter data
char aray2[20];
cin.getline(aray,10,'\n'); //Prompts user to enter data
char *strcpy(char * aray ,char const *aray2); //const since we don't want elements in aray2 to be changed //accidently
cout << aray <<endl;
}
No comments:
Post a Comment