Question: ```
#include <cstring>

char* str0;
const char* str1 = "abc";

// assign str1 to str0
strcpy(str0, str1);    // syntax correct, but run time error
str0 = str1;           // syntax error, cannot convert const char* to char*
string n_str = str1;
str0 = n_str;          // syntax error, cannot convert ...

cout << str0 << endl;  // expected output: abc

```

I'd like to make str0 same as str1 while runtime(after compilation), I don't know how to do it. And for the case `str0 = str1;` I don't understand why it won't work, because str0 points to nothing, while str1 points to a const string literal, so if I now make str0 point to what str1 is pointing to, it should be fine, but it is not. So it there any way to solve it?

Answer: 
Copying `strings` is an expensive operation. But moving `strings` from one place to another is efficient.

casts away the `const`

```cpp
str0 = (char*) str1;

```

or use `std::string` class template library for managing strings. `std::string` owns the character buffer that stores the string value. characters are part of the `string` object. `cont char*` stores the address of such a character buffer but does not own it. 

`c_str` returns a `const char*` that points to a null-terminated string. It is useful when you want to pass the contents. 

```cpp
std::string str1 = "abc";
char* str0;

strcpy(str0, str1.c_str());
printf(str0);

```
`const` is part of the type, and as such, you can cast it "away". This is considered bad practice, but you should think of `const` as a strong suggestion of the original programmer, not to modify it.

```
const char * str1 = "abc";
char * str2 = (char*) str1;

```