[Solved] what happens when I run char * name1 = new char[ 6 ]; strcpy( name1, “Henry” ); char * name2 = name1; name1[0] = ‘D’;


Just add at the bottom of your code
std::cout << name1 << " " <<name2 << std::endl; and you will see wonders.

don’t forget to do delete[] name1;

solved what happens when I run char * name1 = new char[ 6 ]; strcpy( name1, “Henry” ); char * name2 = name1; name1[0] = ‘D’;