What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string mys;
char mya[20]= "Hello world";
mys = mya;
cout << mys << '\n';
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string mys;
char mya[20]= "Hello world";
mys = mya;
cout << mys << '\n';
return 0;
}A. Hello world
B. Hello
C. Error
D. Runtime error
Answer: Option A

Join The Discussion