Hey guys!
I hope you can help me sort one thing out. Why i cannot do this?
Code:
char* ptr = new char[40];
ptr = "First string";
strcpy(ptr, "New string");
However, if i would write this
Code:
char* ptr = new char[40];
strcpy(ptr, "First string");
strcpy(ptr, "New string");
then everything would work out and contents of ptr would change to the new string. In other words, how does function strcpy change from normal assignment. Thank you.